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.
10761 10762 10763 10764 |
# File 'lib/syntax_tree/node.rb', line 10761 def initialize(value:, location:) @value = value @location = location end |
Instance Attribute Details
#value ⇒ Object (readonly)
- String
-
the beginning of the lambda literal
10759 10760 10761 |
# File 'lib/syntax_tree/node.rb', line 10759 def value @value end |
Instance Method Details
#===(other) ⇒ Object
10787 10788 10789 |
# File 'lib/syntax_tree/node.rb', line 10787 def ===(other) other.is_a?(TLambda) && value === other.value end |
#accept(visitor) ⇒ Object
10766 10767 10768 |
# File 'lib/syntax_tree/node.rb', line 10766 def accept(visitor) visitor.visit_tlambda(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
10770 10771 10772 |
# File 'lib/syntax_tree/node.rb', line 10770 def child_nodes [] end |
#copy(value: nil, location: nil) ⇒ Object
10774 10775 10776 10777 10778 10779 |
# File 'lib/syntax_tree/node.rb', line 10774 def copy(value: nil, location: nil) TLambda.new( value: value || self.value, location: location || self.location ) end |
#deconstruct_keys(_keys) ⇒ Object
10783 10784 10785 |
# File 'lib/syntax_tree/node.rb', line 10783 def deconstruct_keys(_keys) { value: value, location: location } end |