Module: Tree::Pool::ClassMethods
- Defined in:
- lib/modular_tree/pool.rb
Instance Method Summary collapse
- #[](uid) ⇒ Object
- #[]=(uid, node) ⇒ Object
-
#empty! ⇒ Object
Useful in tests where a tree is created multiple times.
- #empty? ⇒ Boolean
- #inherited(subclass) ⇒ Object
- #nodes ⇒ Object
- #size ⇒ Object
- #uid?(uid) ⇒ Boolean
- #uids ⇒ Object
Instance Method Details
#[](uid) ⇒ Object
32 |
# File 'lib/modular_tree/pool.rb', line 32 def [](uid) = @pool[uid] |
#[]=(uid, node) ⇒ Object
33 |
# File 'lib/modular_tree/pool.rb', line 33 def []=(uid, node) @pool[uid] = node end |
#empty! ⇒ Object
Useful in tests where a tree is created multiple times
31 |
# File 'lib/modular_tree/pool.rb', line 31 def empty! = @pool.clear # Useful in tests where a tree is created multiple times |
#empty? ⇒ Boolean
30 |
# File 'lib/modular_tree/pool.rb', line 30 def empty? = @pool.empty? |
#inherited(subclass) ⇒ Object
35 36 37 38 |
# File 'lib/modular_tree/pool.rb', line 35 def inherited(subclass) subclass.instance_variable_set(:@pool, @pool) super end |
#nodes ⇒ Object
28 |
# File 'lib/modular_tree/pool.rb', line 28 def nodes = @pool.values |
#size ⇒ Object
29 |
# File 'lib/modular_tree/pool.rb', line 29 def size = @pool.size |
#uid?(uid) ⇒ Boolean
26 |
# File 'lib/modular_tree/pool.rb', line 26 def uid?(uid) = @pool.key?(uid) |
#uids ⇒ Object
27 |
# File 'lib/modular_tree/pool.rb', line 27 def uids = @pool.keys |