Class: Rjq::AST::Try
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#handler ⇒ Object
readonly
Returns the value of attribute handler.
Attributes inherited from Node
Instance Method Summary collapse
- #eval(input, context) ⇒ Object
-
#initialize(body, handler = nil) ⇒ Try
constructor
A new instance of Try.
Methods inherited from Node
#assign_value, #invalid_path_message, #paths, #take, #with_source_span
Constructor Details
#initialize(body, handler = nil) ⇒ Try
Returns a new instance of Try.
690 691 692 693 |
# File 'lib/rjq/ast.rb', line 690 def initialize(body, handler = nil) @body = body @handler = handler end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
688 689 690 |
# File 'lib/rjq/ast.rb', line 688 def body @body end |
#handler ⇒ Object (readonly)
Returns the value of attribute handler.
688 689 690 |
# File 'lib/rjq/ast.rb', line 688 def handler @handler end |
Instance Method Details
#eval(input, context) ⇒ Object
695 696 697 698 699 700 701 |
# File 'lib/rjq/ast.rb', line 695 def eval(input, context) @body.eval(input, context) rescue Rjq::ErrorValue => e (e.outputs || []) + (@handler ? @handler.eval(e.value, context) : []) rescue Rjq::RuntimeError => e @handler ? @handler.eval(e., context) : [] end |