Module: Eloqua::Helper::AttributeMap::ClassMethods

Defined in:
lib/eloqua/helper/attribute_map.rb

Instance Method Summary collapse

Instance Method Details

#eloqua_attribute(attribute) ⇒ Object



30
31
32
# File 'lib/eloqua/helper/attribute_map.rb', line 30

def eloqua_attribute(attribute)
  (attribute_map_reverse.fetch(attribute) { attribute }).to_s
end

#inherited_with_clone_attributes(klass) ⇒ Object



24
25
26
27
28
# File 'lib/eloqua/helper/attribute_map.rb', line 24

def inherited_with_clone_attributes(klass)
  klass.attribute_map = attribute_map.clone
  klass.attribute_map_reverse = attribute_map_reverse.clone
  inherited_without_clone_attributes(klass) if method_defined?(:inherited_without_clone_attributes)
end

#map(hash) ⇒ Object

This shoud always be used over directly editing attribute_map



39
40
41
42
43
44
45
46
47
# File 'lib/eloqua/helper/attribute_map.rb', line 39

def map(hash)
   hash.each do |key, value|
     value = value.to_sym
     key = key.to_sym

     attribute_map[key] = value
     attribute_map_reverse[value] = key
  end
end

#map_attribute(attribute) ⇒ Object



34
35
36
# File 'lib/eloqua/helper/attribute_map.rb', line 34

def map_attribute(attribute)
  attribute_map.fetch(attribute) { attribute.to_s }
end