Module: MadCart::AttributeMapper::ClassMethods

Defined in:
lib/mad_cart/attribute_mapper.rb

Instance Method Summary collapse

Instance Method Details

#map_attribute_name(name) ⇒ Object



17
18
19
# File 'lib/mad_cart/attribute_mapper.rb', line 17

def map_attribute_name(name)
  mapping_hash[name.to_sym] || mapping_hash[name.to_s] || name
end

#mapped_attributesObject



25
26
27
# File 'lib/mad_cart/attribute_mapper.rb', line 25

def mapped_attributes
  mapping_hash.values
end

#mapping_hashObject



21
22
23
# File 'lib/mad_cart/attribute_mapper.rb', line 21

def mapping_hash
  MadCart.config.attribute_maps[self.to_s.demodulize.underscore.pluralize] || {}
end

#unmapped_attributesObject



29
30
31
# File 'lib/mad_cart/attribute_mapper.rb', line 29

def unmapped_attributes
  mapping_hash.keys
end