Class: SyntaxTree::TLamBeg

Inherits:
Node
  • Object
show all
Defined in:
lib/syntax_tree/node.rb

Overview

TLamBeg represents the beginning of the body of a lambda literal using braces.

-> { value }

In the example above the TLamBeg represents the { operator.

Instance Attribute Summary collapse

Attributes inherited from Node

#location

Instance Method Summary collapse

Methods inherited from Node

#construct_keys, #end_char, #format, #pretty_print, #start_char, #to_json, #to_mermaid

Constructor Details

#initialize(value:, location:) ⇒ TLamBeg

Returns a new instance of TLamBeg.



10801
10802
10803
10804
# File 'lib/syntax_tree/node.rb', line 10801

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

Instance Attribute Details

#valueObject (readonly)

String

the beginning of the body of the lambda literal



10799
10800
10801
# File 'lib/syntax_tree/node.rb', line 10799

def value
  @value
end

Instance Method Details

#===(other) ⇒ Object



10827
10828
10829
# File 'lib/syntax_tree/node.rb', line 10827

def ===(other)
  other.is_a?(TLamBeg) && value === other.value
end

#accept(visitor) ⇒ Object



10806
10807
10808
# File 'lib/syntax_tree/node.rb', line 10806

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

#child_nodesObject Also known as: deconstruct



10810
10811
10812
# File 'lib/syntax_tree/node.rb', line 10810

def child_nodes
  []
end

#copy(value: nil, location: nil) ⇒ Object



10814
10815
10816
10817
10818
10819
# File 'lib/syntax_tree/node.rb', line 10814

def copy(value: nil, location: nil)
  TLamBeg.new(
    value: value || self.value,
    location: location || self.location
  )
end

#deconstruct_keys(_keys) ⇒ Object



10823
10824
10825
# File 'lib/syntax_tree/node.rb', line 10823

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