Module: Tree::Pool::ClassMethods

Defined in:
lib/modular_tree/pool.rb

Instance Method Summary collapse

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

Returns:

  • (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

#nodesObject



28
# File 'lib/modular_tree/pool.rb', line 28

def nodes = @pool.values

#sizeObject



29
# File 'lib/modular_tree/pool.rb', line 29

def size = @pool.size

#uid?(uid) ⇒ Boolean

Returns:

  • (Boolean)


26
# File 'lib/modular_tree/pool.rb', line 26

def uid?(uid) = @pool.key?(uid)

#uidsObject



27
# File 'lib/modular_tree/pool.rb', line 27

def uids = @pool.keys