Module: SimpleObjects::Attributes::ClassMethods

Defined in:
lib/simple_objects/attributes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



13
14
15
# File 'lib/simple_objects/attributes.rb', line 13

def attributes
  @attributes
end

Instance Method Details

#attribute(attribute, opts = {}) ⇒ Object



15
16
17
18
19
20
# File 'lib/simple_objects/attributes.rb', line 15

def attribute(attribute, opts = {})
  @attributes ||= {}
  attr = Attribute.new(attribute, opts)
  @attributes[attribute] = attr
  send(:attr_reader, attribute)
end