Module: KirguduBase::Models::MergeableElements::ClassMethods

Included in:
DynamicPages::Element
Defined in:
app/helpers/kirgudu_base/models/mergeable_elements.rb

Instance Method Summary collapse

Instance Method Details

#get_mergeable_attributesObject



21
22
23
# File 'app/helpers/kirgudu_base/models/mergeable_elements.rb', line 21

def get_mergeable_attributes
  @mergeable_attributes || []
end

#mergeable_attributes(*args) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/helpers/kirgudu_base/models/mergeable_elements.rb', line 5

def mergeable_attributes(*args)
  @mergeable_attributes = self.get_mergeable_attributes
  options = args.extract_options! || {}
  args.each do |argument|
    unless argument.is_a?(Symbol)
      raise "Class: #{self} <br/>Mergable Attributes must be of Symbol Class".html_safe
    end
    if @mergeable_attributes.include?(argument)
      raise "Class: #{self} <br/>Attribute '#{argument}' already added to Mergable for this Class".html_safe
    end

    @mergeable_attributes << argument
  end

end