Class: Invoicing::LineItem::ClassInfo
- Inherits:
-
ClassInfo::Base
- Object
- ClassInfo::Base
- Invoicing::LineItem::ClassInfo
- Defined in:
- lib/invoicing/line_item.rb
Overview
Stores state in the ActiveRecord class object
Instance Attribute Summary collapse
-
#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.
239 240 241 242 243 244 245 246 247 248 |
# File 'lib/invoicing/line_item.rb', line 239 def initialize(model_class, previous_info, args) super 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
#uuid_generator ⇒ Object (readonly)
:nodoc:
237 238 239 |
# File 'lib/invoicing/line_item.rb', line 237 def uuid_generator @uuid_generator end |
Instance Method Details
#method(name) ⇒ Object
Allow methods generated by CurrencyValue
to be renamed as well
251 252 253 254 255 256 257 |
# File 'lib/invoicing/line_item.rb', line 251 def method(name) if name.to_s =~ /^(.*)_formatted$/ "#{super($1)}_formatted" else super end end |