Module: MongoModel::AttributeMethods::BeforeTypeCast

Extended by:
ActiveSupport::Concern
Included in:
EmbeddedDocument
Defined in:
lib/mongomodel/concerns/attribute_methods/before_type_cast.rb

Instance Method Summary collapse

Instance Method Details

#attributes_before_type_castObject

Returns a hash of attributes before typecasting.


16
17
18
19
20
21
# File 'lib/mongomodel/concerns/attribute_methods/before_type_cast.rb', line 16

def attributes_before_type_cast
  attributes.keys.inject({}) do |result, key|
    result[key] = attributes.before_type_cast(key)
    result
  end
end

#read_attribute_before_type_cast(name) ⇒ Object

Returns an attribute value before typecasting.


11
12
13
# File 'lib/mongomodel/concerns/attribute_methods/before_type_cast.rb', line 11

def read_attribute_before_type_cast(name)
  attributes.before_type_cast(name.to_sym)
end