Class: Prism::FloatNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::FloatNode
- Defined in:
- lib/prism/node.rb,
ext/prism/api_node.c
Overview
Represents a floating point number literal.
1.0
^^^
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
The value of the floating point number as a Float.
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.
-
#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: Float) -> FloatNode.
-
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, value: Float }.
-
#initialize(source, node_id, location, flags, value) ⇒ FloatNode
constructor
Initialize a new FloatNode node.
-
#inspect ⇒ Object
def inspect -> String.
-
#type ⇒ Object
Return a symbol representation of this node type.
Constructor Details
#initialize(source, node_id, location, flags, value) ⇒ FloatNode
Initialize a new FloatNode node.
6202 6203 6204 6205 6206 6207 6208 |
# File 'lib/prism/node.rb', line 6202 def initialize(source, node_id, location, flags, value) @source = source @node_id = node_id @location = location @flags = flags @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
The value of the floating point number as a Float.
6244 6245 6246 |
# File 'lib/prism/node.rb', line 6244 def value @value end |
Class Method Details
.type ⇒ Object
Return a symbol representation of this node type. See ‘Node::type`.
6257 6258 6259 |
# File 'lib/prism/node.rb', line 6257 def self.type :float_node end |
Instance Method Details
#===(other) ⇒ Object
Implements case-equality for the node. This is effectively == but without comparing the value of locations. Locations are checked only for presence.
6263 6264 6265 6266 |
# File 'lib/prism/node.rb', line 6263 def ===(other) other.is_a?(FloatNode) && (value === other.value) end |
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void
6211 6212 6213 |
# File 'lib/prism/node.rb', line 6211 def accept(visitor) visitor.visit_float_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
6216 6217 6218 |
# File 'lib/prism/node.rb', line 6216 def child_nodes [] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
6226 6227 6228 |
# File 'lib/prism/node.rb', line 6226 def comment_targets [] #: Array[Prism::node | Location] end |
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array
6221 6222 6223 |
# File 'lib/prism/node.rb', line 6221 def compact_child_nodes [] end |
#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: Float) -> FloatNode
6231 6232 6233 |
# File 'lib/prism/node.rb', line 6231 def copy(node_id: self.node_id, location: self.location, flags: self.flags, value: self.value) FloatNode.new(source, node_id, location, flags, value) end |
#deconstruct_keys(keys) ⇒ Object
def deconstruct_keys: (Array keys) -> { node_id: Integer, location: Location, value: Float }
6239 6240 6241 |
# File 'lib/prism/node.rb', line 6239 def deconstruct_keys(keys) { node_id: node_id, location: location, value: value } end |
#inspect ⇒ Object
def inspect -> String
6247 6248 6249 |
# File 'lib/prism/node.rb', line 6247 def inspect InspectVisitor.compose(self) end |
#type ⇒ Object
Return a symbol representation of this node type. See ‘Node#type`.
6252 6253 6254 |
# File 'lib/prism/node.rb', line 6252 def type :float_node end |