Class: ActiveRecord::AttributeDecorators::TypeDecorator

Inherits:
Object
  • Object
show all
Defined in:
lib/active_record/attribute_decorators.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(decorations = {}) ⇒ TypeDecorator

Returns a new instance of TypeDecorator.



62
63
64
# File 'lib/active_record/attribute_decorators.rb', line 62

def initialize(decorations = {})
  @decorations = decorations
end

Instance Method Details

#apply(name, type) ⇒ Object



70
71
72
73
74
75
# File 'lib/active_record/attribute_decorators.rb', line 70

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



66
67
68
# File 'lib/active_record/attribute_decorators.rb', line 66

def merge(*args)
  TypeDecorator.new(@decorations.merge(*args))
end