Class: Prism::IntegerNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::IntegerNode
- Defined in:
- lib/prism/node.rb,
ext/prism/api_node.c more...
Overview
Represents an integer number literal.
1
^
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
The value of the integer literal as a number.
Class Method Summary collapse
-
.type ⇒ Object
Return a symbol representation of this node type.
Instance Method Summary collapse
-
#===(other) ⇒ Object
Implements case-equality for the node.
-
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void.
-
#binary? ⇒ Boolean
def binary?: () -> bool.
-
#child_nodes ⇒ Object
(also: #deconstruct)
def child_nodes: () -> Array[nil | Node].
-
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location].
-
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array.
-
#copy(node_id: self.node_id, location: self.location, flags: self.flags, value: self.value) ⇒ Object
def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Integer) -> IntegerNode.
-
#decimal? ⇒ Boolean
def decimal?: () -> bool.
-
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, value: Integer }.
-
#hexadecimal? ⇒ Boolean
def hexadecimal?: () -> bool.
-
#initialize(source, node_id, location, flags, value) ⇒ IntegerNode
constructor
Initialize a new IntegerNode node.
-
#inspect ⇒ Object
def inspect -> String.
-
#octal? ⇒ Boolean
def octal?: () -> bool.
-
#type ⇒ Object
Return a symbol representation of this node type.
Constructor Details
permalink #initialize(source, node_id, location, flags, value) ⇒ IntegerNode
Initialize a new IntegerNode node.
9261 9262 9263 9264 9265 9266 9267 |
# File 'lib/prism/node.rb', line 9261 def initialize(source, node_id, location, flags, value) @source = source @node_id = node_id @location = location @flags = flags @value = value end |
Instance Attribute Details
permalink #value ⇒ Object (readonly)
The value of the integer literal as a number.
9323 9324 9325 |
# File 'lib/prism/node.rb', line 9323 def value @value end |
Class Method Details
permalink .type ⇒ Object
Return a symbol representation of this node type. See ‘Node::type`.
9336 9337 9338 |
# File 'lib/prism/node.rb', line 9336 def self.type :integer_node end |
Instance Method Details
permalink #===(other) ⇒ Object
Implements case-equality for the node. This is effectively == but without comparing the value of locations. Locations are checked only for presence.
9342 9343 9344 9345 9346 |
# File 'lib/prism/node.rb', line 9342 def ===(other) other.is_a?(IntegerNode) && (flags === other.flags) && (value === other.value) end |
permalink #accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void
9270 9271 9272 |
# File 'lib/prism/node.rb', line 9270 def accept(visitor) visitor.visit_integer_node(self) end |
permalink #binary? ⇒ Boolean
def binary?: () -> bool
9303 9304 9305 |
# File 'lib/prism/node.rb', line 9303 def binary? flags.anybits?(IntegerBaseFlags::BINARY) end |
permalink #child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
9275 9276 9277 |
# File 'lib/prism/node.rb', line 9275 def child_nodes [] end |
permalink #comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
9285 9286 9287 |
# File 'lib/prism/node.rb', line 9285 def comment_targets [] #: Array[Prism::node | Location] end |
permalink #compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array
9280 9281 9282 |
# File 'lib/prism/node.rb', line 9280 def compact_child_nodes [] end |
permalink #copy(node_id: self.node_id, location: self.location, flags: self.flags, value: self.value) ⇒ Object
def copy: (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Integer) -> IntegerNode
9290 9291 9292 |
# File 'lib/prism/node.rb', line 9290 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 |
permalink #decimal? ⇒ Boolean
def decimal?: () -> bool
9308 9309 9310 |
# File 'lib/prism/node.rb', line 9308 def decimal? flags.anybits?(IntegerBaseFlags::DECIMAL) end |
permalink #deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, value: Integer }
9298 9299 9300 |
# File 'lib/prism/node.rb', line 9298 def deconstruct_keys(keys) { node_id: node_id, location: location, value: value } end |
permalink #hexadecimal? ⇒ Boolean
def hexadecimal?: () -> bool
9318 9319 9320 |
# File 'lib/prism/node.rb', line 9318 def hexadecimal? flags.anybits?(IntegerBaseFlags::HEXADECIMAL) end |
permalink #inspect ⇒ Object
def inspect -> String
9326 9327 9328 |
# File 'lib/prism/node.rb', line 9326 def inspect InspectVisitor.compose(self) end |
permalink #octal? ⇒ Boolean
def octal?: () -> bool
9313 9314 9315 |
# File 'lib/prism/node.rb', line 9313 def octal? flags.anybits?(IntegerBaseFlags::OCTAL) end |
permalink #type ⇒ Object
Return a symbol representation of this node type. See ‘Node#type`.
9331 9332 9333 |
# File 'lib/prism/node.rb', line 9331 def type :integer_node end |