class Enumerize::AttributeMap

Attributes

attributes[R]

Public Class Methods

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

Public Instance Methods

<<(attr) click to toggle source
# File lib/enumerize/attribute_map.rb, line 16
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 12
def [](name)
  @attributes[name.to_s]
end
add_dependant(dependant) click to toggle source
# File lib/enumerize/attribute_map.rb, line 33
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 23
def each
  @attributes.each_pair do |_name, attr|
    yield attr
  end
end
empty?() click to toggle source
# File lib/enumerize/attribute_map.rb, line 29
def empty?
  @attributes.empty?
end