module MadCart::AttributeMapper

Public Class Methods

included(base) click to toggle source

def attributes

  Hash[initial_attributes.map {|k, v| [(mapping_hash[k] || mapping_hash[k.to_sym] || k).to_s, v] }]
end
# File lib/mad_cart/attribute_mapper.rb, line 8
def self.included(base)
  base.extend ClassMethods
end

Public Instance Methods

attributes() click to toggle source
# 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