Class: Compo::HashComposite
- Inherits:
-
Object
- Object
- Compo::HashComposite
- Extended by:
- Forwardable
- Includes:
- Composite
- Defined in:
- lib/compo/hash_composite.rb
Overview
Implementation of Composite that stores its children in a Hash.
IDs for items entering a ListComposite may be any permissible hash.
Adding an item at an occupied ID removes the occupant.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#children ⇒ Hash
readonly
Returns the HashComposite’s children, as a Hash.
Instance Method Summary collapse
-
#initialize ⇒ HashComposite
constructor
Initialises a HashComposite.
Methods included from Composite
#add, #get_child, #remove, #remove_id
Constructor Details
#initialize ⇒ HashComposite
Initialises a HashComposite
19 20 21 |
# File 'lib/compo/hash_composite.rb', line 19 def initialize @children = {} end |
Instance Attribute Details
#children ⇒ Hash (readonly)
Returns the HashComposite’s children, as a Hash
34 35 36 |
# File 'lib/compo/hash_composite.rb', line 34 def children @children end |