Class: Prism::IntegerNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::IntegerNode
- Defined in:
- lib/prism/node.rb,
sig/generated/prism/node.rbs,
ext/prism/api_node.c
Overview
Class Method Summary collapse
-
.type ⇒ :integer_node
See
Node.type.
Instance Method Summary collapse
-
#===(other) ⇒ boolish
: (untyped other) -> boolish.
-
#accept(visitor) ⇒ Object
See Node.accept.
-
#binary? ⇒ Boolean
:category: Flags 0b prefix.
-
#child_nodes ⇒ Array[node?]
(also: #deconstruct)
See Node.child_nodes.
-
#compact_child_nodes ⇒ Array[node]
See Node.compact_child_nodes.
-
#copy(node_id: self.node_id, location: self.location, flags: self.flags, value: self.value) ⇒ IntegerNode
:call-seq: copy(**fields) -> IntegerNode.
-
#decimal? ⇒ Boolean
:category: Flags 0d or no prefix.
-
#deconstruct_keys(keys) ⇒ Hash[Symbol, untyped]
: (Array? keys) -> Hash[Symbol, untyped].
-
#each_child_node {|arg0| ... } ⇒ Object
See Node.each_child_node.
-
#hexadecimal? ⇒ Boolean
:category: Flags 0x prefix.
-
#initialize(source, node_id, location, flags, value) ⇒ IntegerNode
constructor
Initialize a new IntegerNode node.
-
#inspect ⇒ String
: () -> String.
-
#octal? ⇒ Boolean
:category: Flags 0o or 0 prefix.
-
#type ⇒ :integer_node
See
Node#type. -
#value ⇒ Integer
:call-seq: value -> Integer.
Constructor Details
#initialize(source, node_id, location, flags, value) ⇒ IntegerNode
Initialize a new IntegerNode node.
: (Source source, Integer node_id, Location location, Integer flags, Integer value) -> void
19124 19125 19126 19127 19128 19129 19130 |
# File 'lib/prism/node.rb', line 19124 def initialize(source, node_id, location, flags, value) @source = source @node_id = node_id @location = location @flags = flags @value = value end |
Class Method Details
.type ⇒ :integer_node
See Node.type.
: () -> :integer_node
19208 19209 19210 |
# File 'lib/prism/node.rb', line 19208 def self.type :integer_node end |
Instance Method Details
#===(other) ⇒ boolish
: (untyped other) -> boolish
19266 19267 19268 19269 19270 |
# File 'lib/prism/node.rb', line 19266 def ===(other) # :nodoc: other.is_a?(IntegerNode) && (flags === other.flags) && (value === other.value) end |
#accept(visitor) ⇒ Object
See Node.accept.
: (_Visitor visitor) -> untyped
19146 19147 19148 |
# File 'lib/prism/node.rb', line 19146 def accept(visitor) visitor.visit_integer_node(self) end |
#binary? ⇒ Boolean
:category: Flags 0b prefix
: () -> bool
19223 19224 19225 |
# File 'lib/prism/node.rb', line 19223 def binary? flags.anybits?(IntegerBaseFlags::BINARY) end |
#child_nodes ⇒ Array[node?] Also known as: deconstruct
See Node.child_nodes.
: () -> Array
19153 19154 19155 |
# File 'lib/prism/node.rb', line 19153 def child_nodes [] end |
#compact_child_nodes ⇒ Array[node]
See Node.compact_child_nodes.
: () -> Array
19169 19170 19171 |
# File 'lib/prism/node.rb', line 19169 def compact_child_nodes [] end |
#copy(node_id: self.node_id, location: self.location, flags: self.flags, value: self.value) ⇒ IntegerNode
:call-seq:
copy(**fields) -> IntegerNode
Creates a copy of self with the given fields, using self as the template.
: (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Integer) -> IntegerNode
19179 19180 19181 |
# File 'lib/prism/node.rb', line 19179 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 |
#decimal? ⇒ Boolean
:category: Flags 0d or no prefix
: () -> bool
19231 19232 19233 |
# File 'lib/prism/node.rb', line 19231 def decimal? flags.anybits?(IntegerBaseFlags::DECIMAL) end |
#deconstruct_keys(keys) ⇒ Hash[Symbol, untyped]
: (Array? keys) -> Hash[Symbol, untyped]
19186 19187 19188 19189 19190 19191 19192 19193 19194 19195 19196 |
# File 'lib/prism/node.rb', line 19186 def deconstruct_keys(keys) # :nodoc: (keys || %i[node_id location value]).each_with_object( {} #: Hash[Symbol, untyped] ) do |key, deconstructed| case key when :node_id then deconstructed[:node_id] = self.node_id when :location then deconstructed[:location] = self.location when :value then deconstructed[:value] = self.value end end end |
#each_child_node ⇒ Enumerator[node, void] #each_child_node ⇒ void
See Node.each_child_node.
: () -> Enumerator[node, void] : () { (node) -> void } -> void
19161 19162 19163 19164 |
# File 'lib/prism/node.rb', line 19161 def each_child_node(&blk) return to_enum(:each_child_node) unless block_given? end |
#hexadecimal? ⇒ Boolean
:category: Flags 0x prefix
: () -> bool
19247 19248 19249 |
# File 'lib/prism/node.rb', line 19247 def hexadecimal? flags.anybits?(IntegerBaseFlags::HEXADECIMAL) end |
#inspect ⇒ String
: () -> String
19213 19214 19215 |
# File 'lib/prism/node.rb', line 19213 def inspect # :nodoc: InspectVisitor.compose(self) end |
#octal? ⇒ Boolean
:category: Flags 0o or 0 prefix
: () -> bool
19239 19240 19241 |
# File 'lib/prism/node.rb', line 19239 def octal? flags.anybits?(IntegerBaseFlags::OCTAL) end |
#type ⇒ :integer_node
See Node#type.
: () -> :integer_node
19201 19202 19203 |
# File 'lib/prism/node.rb', line 19201 def type :integer_node end |
#value ⇒ Integer
:call-seq:
value -> Integer
The value of the integer literal as a number.
: () -> Integer
19257 19258 19259 |
# File 'lib/prism/node.rb', line 19257 def value @value end |