Class: RubyReactor::Template::Result
- Defined in:
- lib/ruby_reactor/template/result.rb
Constant Summary collapse
- PARK_GRACE =
Seconds a WORKER-side reader blocks in-thread before parking. Long enough that a unit finishing "immediately" (the common case) resolves without a park round-trip; short enough that a genuinely slow unit frees the worker thread quickly. Not configurable — the tunable bounds are
async_wait_timeout(blocking) andasync_park_timeout(parked). 5.0
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#step_name ⇒ Object
readonly
Returns the value of attribute step_name.
Instance Method Summary collapse
-
#initialize(step_name, path = nil) ⇒ Result
constructor
A new instance of Result.
- #inspect ⇒ Object
-
#resolve(context) ⇒ Object
For an ordinary step this is exactly what it always was: read the recorded result.
Constructor Details
#initialize(step_name, path = nil) ⇒ Result
Returns a new instance of Result.
8 9 10 11 12 |
# File 'lib/ruby_reactor/template/result.rb', line 8 def initialize(step_name, path = nil) super() @step_name = step_name @path = path end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/ruby_reactor/template/result.rb', line 6 def path @path end |
#step_name ⇒ Object (readonly)
Returns the value of attribute step_name.
6 7 8 |
# File 'lib/ruby_reactor/template/result.rb', line 6 def step_name @step_name end |
Instance Method Details
#inspect ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/ruby_reactor/template/result.rb', line 26 def inspect if @path "result(:#{@step_name}, #{@path.inspect})" else "result(:#{@step_name})" end end |
#resolve(context) ⇒ Object
For an ordinary step this is exactly what it always was: read the recorded result. The async branch only engages when there is no recorded result AND the context carries an async reference for this name, so a synchronous reference costs one extra hash lookup and nothing else.
18 19 20 21 22 23 24 |
# File 'lib/ruby_reactor/template/result.rb', line 18 def resolve(context) value = context.get_result(@step_name) value = resolve_async_reference(context) if value.nil? return nil if value.nil? @path ? extract_path(value, @path) : value end |