module WCC::Data::Mapper::Attributes::ClassMethods

Public Instance Methods

attribute(name, options={}) click to toggle source
# File lib/wcc/data/mapper/attributes.rb, line 35
def attribute(name, options={})
  attributes[name.to_s] = options.freeze
  define_method(name) { self[name] }
  define_method("#{name}=") { |val| self[name] = val } if options[:writer]
end
attributes() click to toggle source
# File lib/wcc/data/mapper/attributes.rb, line 41
def attributes
  @attributes ||= {}
end
inherited(subclass) click to toggle source
Calls superclass method
# File lib/wcc/data/mapper/attributes.rb, line 45
def inherited(subclass)
  super
  subclass.instance_variable_set(:@attributes, attributes.dup)
end