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, #format, #pretty_print, #to_json
Constructor Details
#initialize(value:, location:) ⇒ TLambda
10578
10579
10580
10581
|
# File 'lib/syntax_tree/node.rb', line 10578
def initialize(value:, location:)
@value = value
@location = location
end
|
Instance Attribute Details
#value ⇒ Object
- String
-
the beginning of the lambda literal
10576
10577
10578
|
# File 'lib/syntax_tree/node.rb', line 10576
def value
@value
end
|
Instance Method Details
#===(other) ⇒ Object
10604
10605
10606
|
# File 'lib/syntax_tree/node.rb', line 10604
def ===(other)
other.is_a?(TLambda) && value === other.value
end
|
#accept(visitor) ⇒ Object
10583
10584
10585
|
# File 'lib/syntax_tree/node.rb', line 10583
def accept(visitor)
visitor.visit_tlambda(self)
end
|
#child_nodes ⇒ Object
Also known as:
deconstruct
10587
10588
10589
|
# File 'lib/syntax_tree/node.rb', line 10587
def child_nodes
[]
end
|
#copy(value: nil, location: nil) ⇒ Object
10591
10592
10593
10594
10595
10596
|
# File 'lib/syntax_tree/node.rb', line 10591
def copy(value: nil, location: nil)
TLambda.new(
value: value || self.value,
location: location || self.location
)
end
|
#deconstruct_keys(_keys) ⇒ Object
10600
10601
10602
|
# File 'lib/syntax_tree/node.rb', line 10600
def deconstruct_keys(_keys)
{ value: value, location: location }
end
|