Class: Nem::NodePool
- Inherits:
-
Object
- Object
- Nem::NodePool
- Extended by:
- Forwardable
- Defined in:
- lib/nem/node_pool.rb
Instance Attribute Summary collapse
-
#failed ⇒ Object
readonly
Returns the value of attribute failed.
-
#nodes ⇒ Object
readonly
Returns the value of attribute nodes.
Class Method Summary collapse
Instance Method Summary collapse
- #<<(definitioin) ⇒ Object
- #current ⇒ Object
-
#initialize(nodes) ⇒ NodePool
constructor
A new instance of NodePool.
- #next! ⇒ Object
Constructor Details
#initialize(nodes) ⇒ NodePool
Returns a new instance of NodePool.
13 14 15 16 |
# File 'lib/nem/node_pool.rb', line 13 def initialize(nodes) @nodes = nodes @failed = [] end |
Instance Attribute Details
#failed ⇒ Object (readonly)
Returns the value of attribute failed.
7 8 9 |
# File 'lib/nem/node_pool.rb', line 7 def failed @failed end |
#nodes ⇒ Object (readonly)
Returns the value of attribute nodes.
7 8 9 |
# File 'lib/nem/node_pool.rb', line 7 def nodes @nodes end |
Class Method Details
Instance Method Details
#<<(definitioin) ⇒ Object
27 28 29 |
# File 'lib/nem/node_pool.rb', line 27 def <<(definitioin) @nodes << Nem::Node.new(definitioin) end |
#current ⇒ Object
18 19 20 |
# File 'lib/nem/node_pool.rb', line 18 def current @nodes.first end |
#next! ⇒ Object
22 23 24 25 |
# File 'lib/nem/node_pool.rb', line 22 def next! @failed << @nodes.shift raise 'Exhausted node pool' if length.zero? end |