class YARP::IntegerNode

Represents an integer number literal.

1
^

Public Class Methods

new(flags, location) click to toggle source

def initialize: (flags: Integer, location: Location) -> void

# File lib/yarp/node.rb, line 6341
def initialize(flags, location)
  @flags = flags
  @location = location
end

Public Instance Methods

accept(visitor) click to toggle source

def accept: (visitor: Visitor) -> void

# File lib/yarp/node.rb, line 6347
def accept(visitor)
  visitor.visit_integer_node(self)
end
binary?() click to toggle source

def binary?: () -> bool

# File lib/yarp/node.rb, line 6383
def binary?
  flags.anybits?(IntegerBaseFlags::BINARY)
end
child_nodes() click to toggle source

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

# File lib/yarp/node.rb, line 6352
def child_nodes
  []
end
Also aliased as: deconstruct
comment_targets() click to toggle source

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

# File lib/yarp/node.rb, line 6362
def comment_targets
  []
end
compact_child_nodes() click to toggle source

def compact_child_nodes: () -> Array

# File lib/yarp/node.rb, line 6357
def compact_child_nodes
  []
end
copy(**params) click to toggle source

def copy: (**params) -> IntegerNode

# File lib/yarp/node.rb, line 6367
def copy(**params)
  IntegerNode.new(
    params.fetch(:flags) { flags },
    params.fetch(:location) { location },
  )
end
decimal?() click to toggle source

def decimal?: () -> bool

# File lib/yarp/node.rb, line 6393
def decimal?
  flags.anybits?(IntegerBaseFlags::DECIMAL)
end
deconstruct()

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

Alias for: child_nodes
deconstruct_keys(keys) click to toggle source

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

# File lib/yarp/node.rb, line 6378
def deconstruct_keys(keys)
  { flags: flags, location: location }
end
hexadecimal?() click to toggle source

def hexadecimal?: () -> bool

# File lib/yarp/node.rb, line 6398
def hexadecimal?
  flags.anybits?(IntegerBaseFlags::HEXADECIMAL)
end
inspect(inspector = NodeInspector.new) click to toggle source
# File lib/yarp/node.rb, line 6402
def inspect(inspector = NodeInspector.new)
  inspector << inspector.header(self)
  flags = [("binary" if binary?), ("octal" if octal?), ("decimal" if decimal?), ("hexadecimal" if hexadecimal?)].compact
  inspector << "└── flags: #{flags.empty? ? "∅" : flags.join(", ")}\n"
  inspector.to_str
end
octal?() click to toggle source

def octal?: () -> bool

# File lib/yarp/node.rb, line 6388
def octal?
  flags.anybits?(IntegerBaseFlags::OCTAL)
end
value() click to toggle source

Returns the value of the node as a Ruby Integer.

# File lib/yarp.rb, line 586
def value
  Integer(slice)
end