Class: SyntaxTree::TLambda
Overview
TLambda represents the beginning of a lambda literal.
-> { value }
In the example above the TLambda represents the -> operator.
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
- String
-
the beginning of the lambda literal.
Attributes inherited from Node
Instance Method Summary collapse
- #===(other) ⇒ Object
- #accept(visitor) ⇒ Object
- #child_nodes ⇒ Object (also: #deconstruct)
- #copy(value: nil, location: nil) ⇒ Object
- #deconstruct_keys(_keys) ⇒ Object
-
#initialize(value:, location:) ⇒ TLambda
constructor
A new instance of TLambda.
Methods inherited from Node
#construct_keys, #end_char, #format, #pretty_print, #start_char, #to_json, #to_mermaid
Constructor Details
#initialize(value:, location:) ⇒ TLambda
Returns a new instance of TLambda.
10697 10698 10699 10700 |
# File 'lib/syntax_tree/node.rb', line 10697 def initialize(value:, location:) @value = value @location = location end |
Instance Attribute Details
#value ⇒ Object (readonly)
- String
-
the beginning of the lambda literal
10695 10696 10697 |
# File 'lib/syntax_tree/node.rb', line 10695 def value @value end |
Instance Method Details
#===(other) ⇒ Object
10723 10724 10725 |
# File 'lib/syntax_tree/node.rb', line 10723 def ===(other) other.is_a?(TLambda) && value === other.value end |
#accept(visitor) ⇒ Object
10702 10703 10704 |
# File 'lib/syntax_tree/node.rb', line 10702 def accept(visitor) visitor.visit_tlambda(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
10706 10707 10708 |
# File 'lib/syntax_tree/node.rb', line 10706 def child_nodes [] end |
#copy(value: nil, location: nil) ⇒ Object
10710 10711 10712 10713 10714 10715 |
# File 'lib/syntax_tree/node.rb', line 10710 def copy(value: nil, location: nil) TLambda.new( value: value || self.value, location: location || self.location ) end |
#deconstruct_keys(_keys) ⇒ Object
10719 10720 10721 |
# File 'lib/syntax_tree/node.rb', line 10719 def deconstruct_keys(_keys) { value: value, location: location } end |