Class: Perpetuity::AttributeSet
- Inherits:
-
Object
- Object
- Perpetuity::AttributeSet
- Includes:
- Enumerable
- Defined in:
- lib/perpetuity/attribute_set.rb
Instance Method Summary collapse
- #<<(attribute) ⇒ Object
- #[](name) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize ⇒ AttributeSet
constructor
A new instance of AttributeSet.
Constructor Details
#initialize ⇒ AttributeSet
Returns a new instance of AttributeSet.
7 8 9 |
# File 'lib/perpetuity/attribute_set.rb', line 7 def initialize @attributes = Set.new end |
Instance Method Details
#<<(attribute) ⇒ Object
11 12 13 |
# File 'lib/perpetuity/attribute_set.rb', line 11 def << attribute @attributes << attribute end |
#[](name) ⇒ Object
15 16 17 |
# File 'lib/perpetuity/attribute_set.rb', line 15 def [] name @attributes.find { |attr| attr.name == name } end |
#each(&block) ⇒ Object
19 20 21 |
# File 'lib/perpetuity/attribute_set.rb', line 19 def each &block @attributes.each(&block) end |