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

#format, #pretty_print, #to_json

Constructor Details

#initialize(value:, location:) ⇒ TLambda

Returns a new instance of TLambda.



8470
8471
8472
8473
# File 'lib/syntax_tree/node.rb', line 8470

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

Instance Attribute Details

#valueObject (readonly)

String

the beginning of the lambda literal



8468
8469
8470
# File 'lib/syntax_tree/node.rb', line 8468

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



8475
8476
8477
# File 'lib/syntax_tree/node.rb', line 8475

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

#child_nodesObject Also known as: deconstruct



8479
8480
8481
# File 'lib/syntax_tree/node.rb', line 8479

def child_nodes
  []
end

#deconstruct_keys(keys) ⇒ Object



8485
8486
8487
# File 'lib/syntax_tree/node.rb', line 8485

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