module WCC::Data::Mapper::Attributes::InstanceMethods

Attributes

attributes[R]

Public Class Methods

new(attributes={}) click to toggle source
# File lib/wcc/data/mapper/attributes.rb, line 13
def initialize(attributes={})
  @attributes = attributes
end

Public Instance Methods

[](attribute) click to toggle source
# File lib/wcc/data/mapper/attributes.rb, line 17
def [](attribute)
  self.class.attributes.fetch(attribute.to_s) {
    raise KeyError, "The attribute #{attribute} is not defined"
  }
  @attributes[attribute.to_s]
end
[]=(attribute, value) click to toggle source
# File lib/wcc/data/mapper/attributes.rb, line 24
def []=(attribute, value)
  self.class.attributes.fetch(attribute.to_s) {
    raise KeyError, "The attribute #{attribute} is not defined"
  }
  @attributes[attribute.to_s] = value
end