Class: ActiveModel::AttributeSet::Builder

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

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(types, default_attributes = {}) ⇒ Builder

Returns a new instance of Builder.



10
11
12
13
# File 'activemodel/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_attributesObject (readonly)

Returns the value of attribute default_attributes



8
9
10
# File 'activemodel/lib/active_model/attribute_set/builder.rb', line 8

def default_attributes
  @default_attributes
end

#typesObject (readonly)

Returns the value of attribute types



8
9
10
# File 'activemodel/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 'activemodel/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