Module: MongoModel::AttributeMethods::Read

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

Instance Method Summary collapse

Instance Method Details

#[](name) ⇒ Object

Returns the value of the attribute identified by name after it has been typecast (for example, “2004-12-12” in a date property is cast to a date object, like Date.new(2004, 12, 12)). (Alias for read_attribute).


22
23
24
# File 'lib/mongomodel/concerns/attribute_methods/read.rb', line 22

def [](name)
  read_attribute(name)
end

#read_attribute(name) ⇒ Object

Returns the value of the attribute identified by name after it has been typecast (for example, “2004-12-12” in a date property is cast to a date object, like Date.new(2004, 12, 12)).


15
16
17
# File 'lib/mongomodel/concerns/attribute_methods/read.rb', line 15

def read_attribute(name)
  attributes[name.to_sym]
end