Class: SyntaxTree::TLambda

Inherits:
Node
  • Object
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

Returns a new instance of TLambda.



8576
8577
8578
8579
# File 'lib/syntax_tree/node.rb', line 8576

def initialize(value:, location:)
  @value = value
  @location = location
end

Instance Attribute Details

#valueObject (readonly)

String

the beginning of the lambda literal



8574
8575
8576
# File 'lib/syntax_tree/node.rb', line 8574

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



8581
8582
8583
# File 'lib/syntax_tree/node.rb', line 8581

def accept(visitor)
  visitor.visit_tlambda(self)
end

#child_nodesObject Also known as: deconstruct



8585
8586
8587
# File 'lib/syntax_tree/node.rb', line 8585

def child_nodes
  []
end

#deconstruct_keys(_keys) ⇒ Object



8591
8592
8593
# File 'lib/syntax_tree/node.rb', line 8591

def deconstruct_keys(_keys)
  { value: value, location: location }
end