Class: Invoicing::LedgerItem::ClassInfo
- Inherits:
-
ClassInfo::Base
- Object
- ClassInfo::Base
- Invoicing::LedgerItem::ClassInfo
- Defined in:
- lib/invoicing/ledger_item.rb
Overview
Stores state in the ActiveRecord class object
Instance Attribute Summary collapse
-
#subtype ⇒ Object
readonly
:nodoc:.
-
#uuid_generator ⇒ Object
readonly
:nodoc:.
Attributes inherited from ClassInfo::Base
#all_args, #all_options, #current_args, #current_options, #model_class, #new_args, #previous_info
Instance Method Summary collapse
-
#initialize(model_class, previous_info, args) ⇒ ClassInfo
constructor
A new instance of ClassInfo.
-
#method(name) ⇒ Object
Allow methods generated by
CurrencyValue
to be renamed as well.
Methods inherited from ClassInfo::Base
Constructor Details
#initialize(model_class, previous_info, args) ⇒ ClassInfo
Returns a new instance of ClassInfo.
829 830 831 832 833 834 835 836 837 838 839 |
# File 'lib/invoicing/ledger_item.rb', line 829 def initialize(model_class, previous_info, args) super @subtype = [:subtype] begin # try to load the UUID gem require 'uuid' @uuid_generator = UUID.new rescue LoadError, NameError # silently ignore if gem not found @uuid_generator = nil end end |
Instance Attribute Details
#subtype ⇒ Object (readonly)
:nodoc:
827 828 829 |
# File 'lib/invoicing/ledger_item.rb', line 827 def subtype @subtype end |
#uuid_generator ⇒ Object (readonly)
:nodoc:
827 828 829 |
# File 'lib/invoicing/ledger_item.rb', line 827 def uuid_generator @uuid_generator end |
Instance Method Details
#method(name) ⇒ Object
Allow methods generated by CurrencyValue
to be renamed as well
842 843 844 845 846 847 848 |
# File 'lib/invoicing/ledger_item.rb', line 842 def method(name) if name.to_s =~ /^(.*)_formatted$/ "#{super($1)}_formatted" else super end end |