Class: ActiveRecord::AttributeDecorators::TypeDecorator

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

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(decorations = {}) ⇒ TypeDecorator


38
39
40
# File 'activerecord/lib/active_record/attribute_decorators.rb', line 38

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

Instance Method Details

#apply(name, type) ⇒ Object


46
47
48
49
50
51
# File 'activerecord/lib/active_record/attribute_decorators.rb', line 46

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


42
43
44
# File 'activerecord/lib/active_record/attribute_decorators.rb', line 42

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