Class: RubyReactor::Template::Result
- Defined in:
- lib/ruby_reactor/template/result.rb
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
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
25 26 27 28 29 30 31 |
# File 'lib/ruby_reactor/template/result.rb', line 25 def inspect if @path "result(:#{@step_name}, #{@path.inspect})" else "result(:#{@step_name})" end end |
#resolve(context) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ruby_reactor/template/result.rb', line 14 def resolve(context) value = context.get_result(@step_name) return nil if value.nil? if @path extract_path(value, @path) else value end end |