Class: SyntaxTree::Bf::Increment

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

Overview

+

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Node

#format, #pretty_print

Constructor Details

#initialize(location:) ⇒ Increment

Returns a new instance of Increment.



67
68
69
# File 'lib/syntax_tree/bf/nodes.rb', line 67

def initialize(location:)
  @location = location
end

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.



65
66
67
# File 'lib/syntax_tree/bf/nodes.rb', line 65

def location
  @location
end

Instance Method Details

#accept(visitor) ⇒ Object



71
72
73
# File 'lib/syntax_tree/bf/nodes.rb', line 71

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

#child_nodesObject Also known as: deconstruct



75
76
77
# File 'lib/syntax_tree/bf/nodes.rb', line 75

def child_nodes
  []
end

#deconstruct_keys(keys) ⇒ Object



81
82
83
# File 'lib/syntax_tree/bf/nodes.rb', line 81

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