Class: SyntaxTree::TLambda
- Inherits:
-
Node
- Object
- Node
- SyntaxTree::TLambda
show all
- Defined in:
- lib/syntax_tree/node.rb
Overview
TLambda represents the beginning of a lambda literal.
-> { value }
In the example above the TLambda represents the -> operator.
Instance Attribute Summary collapse
Attributes inherited from Node
#location
Instance Method Summary
collapse
Methods inherited from Node
#construct_keys, #end_char, #format, #pretty_print, #start_char, #to_json, #to_mermaid
Constructor Details
#initialize(value:, location:) ⇒ TLambda
10728
10729
10730
10731
|
# File 'lib/syntax_tree/node.rb', line 10728
def initialize(value:, location:)
@value = value
@location = location
end
|
Instance Attribute Details
#value ⇒ Object
- String
-
the beginning of the lambda literal
10726
10727
10728
|
# File 'lib/syntax_tree/node.rb', line 10726
def value
@value
end
|
Instance Method Details
#===(other) ⇒ Object
10754
10755
10756
|
# File 'lib/syntax_tree/node.rb', line 10754
def ===(other)
other.is_a?(TLambda) && value === other.value
end
|
#accept(visitor) ⇒ Object
10733
10734
10735
|
# File 'lib/syntax_tree/node.rb', line 10733
def accept(visitor)
visitor.visit_tlambda(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
10737
10738
10739
|
# File 'lib/syntax_tree/node.rb', line 10737
def child_nodes
[]
end
|
#copy(value: nil, location: nil) ⇒ Object
10741
10742
10743
10744
10745
10746
|
# File 'lib/syntax_tree/node.rb', line 10741
def copy(value: nil, location: nil)
TLambda.new(
value: value || self.value,
location: location || self.location
)
end
|
#deconstruct_keys(_keys) ⇒ Object
10750
10751
10752
|
# File 'lib/syntax_tree/node.rb', line 10750
def deconstruct_keys(_keys)
{ value: value, location: location }
end
|