Class: ActiveModel::AttributeSet::Builder
- Inherits:
-
Object
- Object
- ActiveModel::AttributeSet::Builder
- Defined in:
- lib/active_model/attribute_set/builder.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#default_attributes ⇒ Object
readonly
Returns the value of attribute default_attributes.
-
#types ⇒ Object
readonly
Returns the value of attribute types.
Instance Method Summary collapse
- #build_from_database(values = {}, additional_types = {}) ⇒ Object
-
#initialize(types, default_attributes = {}) ⇒ Builder
constructor
A new instance of Builder.
Constructor Details
#initialize(types, default_attributes = {}) ⇒ Builder
Returns a new instance of Builder.
10 11 12 13 |
# File 'lib/active_model/attribute_set/builder.rb', line 10 def initialize(types, default_attributes = {}) @types = types @default_attributes = default_attributes end |
Instance Attribute Details
#default_attributes ⇒ Object (readonly)
Returns the value of attribute default_attributes.
8 9 10 |
# File 'lib/active_model/attribute_set/builder.rb', line 8 def default_attributes @default_attributes end |
#types ⇒ Object (readonly)
Returns the value of attribute types.
8 9 10 |
# File 'lib/active_model/attribute_set/builder.rb', line 8 def types @types end |
Instance Method Details
#build_from_database(values = {}, additional_types = {}) ⇒ Object
15 16 17 18 |
# File 'lib/active_model/attribute_set/builder.rb', line 15 def build_from_database(values = {}, additional_types = {}) attributes = LazyAttributeHash.new(types, values, additional_types, default_attributes) AttributeSet.new(attributes) end |