Class: ActiveRecord::AttributeDecorators::TypeDecorator
- Defined in:
- activerecord/lib/active_record/attribute_decorators.rb
Overview
:nodoc:
Instance Method Summary collapse
- #apply(name, type) ⇒ Object
-
#initialize(decorations = {}) ⇒ TypeDecorator
constructor
A new instance of TypeDecorator.
- #merge(*args) ⇒ Object
Constructor Details
#initialize(decorations = {}) ⇒ TypeDecorator
Returns a new instance of TypeDecorator.
61 62 63 |
# File 'activerecord/lib/active_record/attribute_decorators.rb', line 61 def initialize(decorations = {}) @decorations = decorations end |
Instance Method Details
#apply(name, type) ⇒ Object
69 70 71 72 73 74 |
# File 'activerecord/lib/active_record/attribute_decorators.rb', line 69 def apply(name, type) decorations = decorators_for(name, type) decorations.inject(type) do |new_type, block| block.call(new_type) end end |
#merge(*args) ⇒ Object
65 66 67 |
# File 'activerecord/lib/active_record/attribute_decorators.rb', line 65 def merge(*args) TypeDecorator.new(@decorations.merge(*args)) end |