Module: Adify::Methods

Defined in:
lib/adify.rb

Instance Method Summary collapse

Instance Method Details

#adification(item = nil) ⇒ Object



33
34
35
36
37
# File 'lib/adify.rb', line 33

def adification(item = nil)
  ad_attr = item.nil? ? self.adify_attributes : self.adify_attributes.adify_merge(item.adify_attributes)
  item_for_adification = item.nil? ? self : item
  ad_attr.update_values{|v| get_adify_value(item_for_adification,v)}.symbolize_keys_recursively.clone
end

#adify_attributesObject



27
28
29
30
31
# File 'lib/adify.rb', line 27

def adify_attributes
  my_attributes = get_adify_attributes
  merge_with = self.respond_to?(:ancestors) ? self.ancestors.slice(1,self.ancestors.length).select{|c| c.respond_to?(:adify_attributes)}.first : self.class
  merge_with.respond_to?(:adify_attributes) ? merge_with.adify_attributes.adify_merge(my_attributes) : my_attributes
end