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 yarp/node.rb, line 5824
def initialize(flags, location)
  @flags = flags
  @location = location
end

Public Instance Methods

accept(visitor) click to toggle source

def accept: (visitor: Visitor) -> void

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

def binary?: () -> bool

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

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

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

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

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

def copy: (**params) -> IntegerNode

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

def decimal?: () -> bool

# File yarp/node.rb, line 5871
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 yarp/node.rb, line 5856
def deconstruct_keys(keys)
  { flags: flags, location: location }
end
hexadecimal?() click to toggle source

def hexadecimal?: () -> bool

# File yarp/node.rb, line 5876
def hexadecimal?
  flags.anybits?(IntegerBaseFlags::HEXADECIMAL)
end
inspect(inspector = NodeInspector.new) click to toggle source
# File yarp/node.rb, line 5880
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 yarp/node.rb, line 5866
def octal?
  flags.anybits?(IntegerBaseFlags::OCTAL)
end
value() click to toggle source

Returns the value of the node as a Ruby Integer.

# File yarp.rb, line 587
def value
  Integer(slice)
end