Module: Spread2RDF::Attributes::ClassMethods

Defined in:
lib/spread2rdf/attributes.rb

Instance Method Summary collapse

Instance Method Details

#attributesObject



6
7
8
9
10
11
12
13
14
# File 'lib/spread2rdf/attributes.rb', line 6

def attributes
  if superclass.respond_to?(:attributes) and
      (super_attributes = superclass.attributes).is_a? Hash
    @attributes ||= {}
    @attributes.reverse_merge(super_attributes)
  else
    @attributes
  end
end

#attributes=(defaults) ⇒ Object



16
17
18
19
# File 'lib/spread2rdf/attributes.rb', line 16

def attributes=(defaults)
  defaults.each { |attribute, default_value| attr_accessor attribute }
  @attributes = @attributes.try(:merge, defaults) || defaults
end

#normalize_attributes(values) ⇒ Object



21
22
23
# File 'lib/spread2rdf/attributes.rb', line 21

def normalize_attributes(values)
  values
end