123456789_123456789_123456789_123456789_123456789_

Class: ActiveModel::AttributeRegistration::ClassMethods::PendingDecorator

Do not use. This class is for internal use only.
Relationships & Source Files
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, ::Struct
Instance Chain:
self, ::Struct
Inherits: Struct
  • ::Object
Defined in: activemodel/lib/active_model/attribute_registration.rb

Instance Attribute Summary

Instance Method Summary

Instance Attribute Details

#decorator (rw, private)

[ GitHub ]

  
# File 'activemodel/lib/active_model/attribute_registration.rb', line 98

PendingDecorator = Struct.new(:names, :decorator)

#names (rw, private)

[ GitHub ]

  
# File 'activemodel/lib/active_model/attribute_registration.rb', line 98

PendingDecorator = Struct.new(:names, :decorator)

Instance Method Details

#apply_to(attributes)

[ GitHub ]

  
# File 'activemodel/lib/active_model/attribute_registration.rb', line 99

def apply_to(attributes)
  (names || attributes.keys.select { |name| attributes[name].initialized? }).each do |name|
    attribute = attributes[name] || Attribute.null(name)
    type = decorator.call(name, attribute.type)
    attributes[name] = attribute.with_type(type) if type
  end
end