Class: Hegel::Stateful::Pool::ValuesConsumed
- Defined in:
- lib/hegel/stateful/pool.rb,
sig/hegel.rbs
Overview
Hegel::Generator returned by Pool#values_consumed. Same reasoning as ValuesReusable above for staying un-namespaced and for not pre-checking emptiness.
Instance Method Summary collapse
- #do_draw(tc) ⇒ Object
-
#initialize(pool, values) ⇒ ValuesConsumed
constructor
A new instance of ValuesConsumed.
Methods inherited from Generator
Constructor Details
#initialize(pool, values) ⇒ ValuesConsumed
Returns a new instance of ValuesConsumed.
96 97 98 99 100 |
# File 'lib/hegel/stateful/pool.rb', line 96 def initialize(pool, values) super() @pool = pool @values = values end |
Instance Method Details
#do_draw(tc) ⇒ Object
102 103 104 105 106 107 |
# File 'lib/hegel/stateful/pool.rb', line 102 def do_draw(tc) variable_id = tc.pool_generate(@pool, true) value = @values.fetch(variable_id) @values.delete(variable_id) value end |