Class: Rjq::AST::Label
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
Attributes inherited from Node
Instance Method Summary collapse
- #eval(input, context) ⇒ Object
-
#initialize(label, body) ⇒ Label
constructor
A new instance of Label.
Methods inherited from Node
#assign_value, #invalid_path_message, #paths, #take, #with_source_span
Constructor Details
#initialize(label, body) ⇒ Label
Returns a new instance of Label.
756 757 758 759 |
# File 'lib/rjq/ast.rb', line 756 def initialize(label, body) @label = label @body = body end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
754 755 756 |
# File 'lib/rjq/ast.rb', line 754 def body @body end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
754 755 756 |
# File 'lib/rjq/ast.rb', line 754 def label @label end |
Instance Method Details
#eval(input, context) ⇒ Object
761 762 763 764 765 766 767 768 769 |
# File 'lib/rjq/ast.rb', line 761 def eval(input, context) @body.eval(input, context) rescue BreakSignal => e raise unless e.label == @label return e.outputs if e.outputs e.value.nil? ? [] : [e.value] end |