Module: Sphene::Attributes::ClassMethods

Defined in:
lib/sphene/attributes.rb

Instance Method Summary collapse

Instance Method Details

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



58
59
60
61
62
63
64
# File 'lib/sphene/attributes.rb', line 58

def attribute(name, type, options = {})
  name = name.to_sym
  options[:type] = type
  attributes[name] = options
  define_attribute_setter_method(name)
  define_attribute_getter_method(name)
end

#attributesObject



71
72
73
# File 'lib/sphene/attributes.rb', line 71

def attributes
  @attributes ||= Hash.new({})
end

#inherited(base) ⇒ Object



66
67
68
69
# File 'lib/sphene/attributes.rb', line 66

def inherited(base)
  super
  base.instance_variable_set(:@attributes, attributes.dup)
end