Module: MadCart::AttributeMapper
- Defined in:
- lib/mad_cart/attribute_mapper.rb
Defined Under Namespace
Modules: ClassMethods
Class Method Summary collapse
-
.included(base) ⇒ Object
def attributes Hash[initial_attributes.map {|k, v| [(mapping_hash || mapping_hash || k).to_s, v] }] end.
Instance Method Summary collapse
Class Method Details
.included(base) ⇒ Object
def attributes
Hash[initial_attributes.map {|k, v| [(mapping_hash[k] || mapping_hash[k.to_sym] || k).to_s, v] }]
end
8 9 10 |
# File 'lib/mad_cart/attribute_mapper.rb', line 8 def self.included(base) base.extend ClassMethods end |
Instance Method Details
#attributes ⇒ Object
12 13 14 |
# File 'lib/mad_cart/attribute_mapper.rb', line 12 def attributes Hash[self.class.exposed_attributes.map{|a| [a.to_s, self.send(a)]}] end |