Class: ActiveModel::AttributeRegistration::ClassMethods::PendingAttribute

Inherits:
Object
  • Object
show all
Defined in:
activemodel/lib/active_model/attribute_registration.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#defaultObject

Returns the value of attribute default.


34
35
36
# File 'activemodel/lib/active_model/attribute_registration.rb', line 34

def default
  @default
end

#typeObject

Returns the value of attribute type.


34
35
36
# File 'activemodel/lib/active_model/attribute_registration.rb', line 34

def type
  @type
end

Instance Method Details

#apply_to(attribute) ⇒ Object


36
37
38
39
40
# File 'activemodel/lib/active_model/attribute_registration.rb', line 36

def apply_to(attribute)
  attribute = attribute.with_type(type || attribute.type)
  attribute = attribute.with_user_default(default) if defined?(@default)
  attribute
end