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