Module: Ricordami::HasAttributes::ClassMethods

Defined in:
lib/ricordami/has_attributes.rb

Instance Method Summary collapse

Instance Method Details

#attribute(name, options = {}) ⇒ Object



22
23
24
25
26
27
28
# File 'lib/ricordami/has_attributes.rb', line 22

def attribute(name, options = {})
  instance = Attribute.new(name, options)
  options = OptionsExpander.new(self, options)
  self.attributes[name.to_sym] = instance
  index(instance.indexed => name.to_sym) if instance.indexed?
  instance
end

#attributesObject



18
19
20
# File 'lib/ricordami/has_attributes.rb', line 18

def attributes
  @attributes ||= {}
end

#attributes_key_name_for(id) ⇒ Object



30
31
32
# File 'lib/ricordami/has_attributes.rb', line 30

def attributes_key_name_for(id)
  KeyNamer.attributes(self.to_s, :id => id)
end