Class: YARP::IntegerNode

Inherits:
YARPNode
  • Object
show all
Defined in:
lib/yarp/node.rb,
lib/yarp.rb,
ext/yarp/api_node.c

Overview

Represents an integer number literal.

1
^

Instance Method Summary collapse

Constructor Details

#initialize(location) ⇒ IntegerNode

def initialize: (location: Location) -> void



5745
5746
5747
# File 'lib/yarp/node.rb', line 5745

def initialize(location)
  @location = location
end

Instance Method Details

#accept(visitor) ⇒ Object

def accept: (visitor: Visitor) -> void



5750
5751
5752
# File 'lib/yarp/node.rb', line 5750

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

#child_nodesObject Also known as: deconstruct

def child_nodes: () -> Array[nil | Node]



5755
5756
5757
# File 'lib/yarp/node.rb', line 5755

def child_nodes
  []
end

#comment_targetsObject

def comment_targets: () -> Array[Node | Location]



5760
5761
5762
# File 'lib/yarp/node.rb', line 5760

def comment_targets
  []
end

#copy(**params) ⇒ Object

def copy: (**params) -> IntegerNode



5765
5766
5767
5768
5769
# File 'lib/yarp/node.rb', line 5765

def copy(**params)
  IntegerNode.new(
    params.fetch(:location) { location },
  )
end

#deconstruct_keys(keys) ⇒ Object

def deconstruct_keys: (keys: Array) -> Hash[Symbol, nil | Node | Array | String | Token | Array | Location]



5775
5776
5777
# File 'lib/yarp/node.rb', line 5775

def deconstruct_keys(keys)
  { location: location }
end

#inspect(inspector = NodeInspector.new) ⇒ Object



5779
5780
5781
5782
# File 'lib/yarp/node.rb', line 5779

def inspect(inspector = NodeInspector.new)
  inspector << inspector.header(self)
  inspector.to_str
end

#valueObject



405
406
407
# File 'lib/yarp.rb', line 405

def value
  Integer(slice)
end