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



4222
4223
4224
# File 'lib/yarp/node.rb', line 4222

def initialize(location)
  @location = location
end

Instance Method Details

#accept(visitor) ⇒ Object

def accept: (visitor: Visitor) -> void



4227
4228
4229
# File 'lib/yarp/node.rb', line 4227

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

#child_nodesObject Also known as: deconstruct

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



4232
4233
4234
# File 'lib/yarp/node.rb', line 4232

def child_nodes
  []
end

#copy(**params) ⇒ Object

def copy: (**params) -> IntegerNode



4237
4238
4239
4240
4241
# File 'lib/yarp/node.rb', line 4237

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]



4247
4248
4249
# File 'lib/yarp/node.rb', line 4247

def deconstruct_keys(keys)
  { location: location }
end

#valueObject



349
350
351
# File 'lib/yarp.rb', line 349

def value
  Integer(slice)
end