class Prism::IntegerNode
Represents an integer number literal.
1 ^
Attributes
The value of the integer literal as a number.
Public Class Methods
Initialize a new IntegerNode
node.
# File lib/prism/node.rb, line 9229 def initialize(source, node_id, location, flags, value) @source = source @node_id = node_id @location = location @flags = flags @value = value end
Return a symbol representation of this node type. See ‘Node::type`.
# File lib/prism/node.rb, line 9304 def self.type :integer_node end
Public Instance Methods
Implements case-equality for the node. This is effectively == but without comparing the value of locations. Locations are checked only for presence.
# File lib/prism/node.rb, line 9310 def ===(other) other.is_a?(IntegerNode) && (flags === other.flags) && (value === other.value) end
def accept: (Visitor
visitor) -> void
# File lib/prism/node.rb, line 9238 def accept(visitor) visitor.visit_integer_node(self) end
def binary?: () -> bool
# File lib/prism/node.rb, line 9271 def binary? flags.anybits?(IntegerBaseFlags::BINARY) end
def child_nodes
: () -> Array[nil | Node]
# File lib/prism/node.rb, line 9243 def child_nodes [] end
def comment_targets
: () -> Array[Node | Location]
# File lib/prism/node.rb, line 9253 def comment_targets [] #: Array[Prism::node | Location] end
def compact_child_nodes
: () -> Array
# File lib/prism/node.rb, line 9248 def compact_child_nodes [] end
def copy: (?node_id: Integer
, ?location: Location
, ?flags: Integer
, ?value: Integer
) -> IntegerNode
# File lib/prism/node.rb, line 9258 def copy(node_id: self.node_id, location: self.location, flags: self.flags, value: self.value) IntegerNode.new(source, node_id, location, flags, value) end
def decimal?: () -> bool
# File lib/prism/node.rb, line 9276 def decimal? flags.anybits?(IntegerBaseFlags::DECIMAL) end
def deconstruct_keys
: (Array keys) -> { node_id: Integer
, location: Location
, value: Integer
}
# File lib/prism/node.rb, line 9266 def deconstruct_keys(keys) { node_id: node_id, location: location, value: value } end
def hexadecimal?: () -> bool
# File lib/prism/node.rb, line 9286 def hexadecimal? flags.anybits?(IntegerBaseFlags::HEXADECIMAL) end
def inspect -> String
# File lib/prism/node.rb, line 9294 def inspect InspectVisitor.compose(self) end
def octal?: () -> bool
# File lib/prism/node.rb, line 9281 def octal? flags.anybits?(IntegerBaseFlags::OCTAL) end
Return a symbol representation of this node type. See ‘Node#type`.
# File lib/prism/node.rb, line 9299 def type :integer_node end