Module: Recliner::AttributeMethods::Read
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/recliner/attribute_methods/read.rb
Instance Method Summary collapse
-
#[](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)). -
#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)).
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).
23 24 25 |
# File 'lib/recliner/attribute_methods/read.rb', line 23 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)).
12 13 14 15 16 17 18 |
# File 'lib/recliner/attribute_methods/read.rb', line 12 def read_attribute(name) if prop = property(name) attributes[prop.as] else attributes[name.to_s] end end |