class Enumerize::AttributeMap

Public Class Methods

new() click to toggle source
# File lib/enumerize/attribute_map.rb, line 3
def initialize
  @attributes = {}
  @dependants = []
end

Public Instance Methods

<<(attr) click to toggle source
# File lib/enumerize/attribute_map.rb, line 12
def <<(attr)
  @attributes[attr.name.to_s] = attr
  @dependants.each do |dependant|
    dependant << attr
  end
end
[](name) click to toggle source
# File lib/enumerize/attribute_map.rb, line 8
def [](name)
  @attributes[name.to_s]
end
add_dependant(dependant) click to toggle source
# File lib/enumerize/attribute_map.rb, line 29
def add_dependant(dependant)
  @dependants << dependant
  each do |attr|
    dependant << attr
  end
end
each() { |attr| ... } click to toggle source
# File lib/enumerize/attribute_map.rb, line 19
def each
  @attributes.each_pair do |_name, attr|
    yield attr
  end
end
empty?() click to toggle source
# File lib/enumerize/attribute_map.rb, line 25
def empty?
  @attributes.empty?
end