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.



7927
7928
7929
7930
# File 'lib/syntax_tree/node.rb', line 7927

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

Instance Attribute Details

#valueObject (readonly)

String

the beginning of the lambda literal



7925
7926
7927
# File 'lib/syntax_tree/node.rb', line 7925

def value
  @value
end

Instance Method Details

#accept(visitor) ⇒ Object



7932
7933
7934
# File 'lib/syntax_tree/node.rb', line 7932

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

#child_nodesObject Also known as: deconstruct



7936
7937
7938
# File 'lib/syntax_tree/node.rb', line 7936

def child_nodes
  []
end

#deconstruct_keys(keys) ⇒ Object



7942
7943
7944
# File 'lib/syntax_tree/node.rb', line 7942

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