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.
7071 7072 7073 7074 7075 7076 7077 |
# File 'lib/prism/node.rb', line 7071 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.
7113 7114 7115 |
# File 'lib/prism/node.rb', line 7113 def value @value end |
Class Method Details
.type ⇒ Object
Return a symbol representation of this node type. See ‘Node::type`.
7126 7127 7128 |
# File 'lib/prism/node.rb', line 7126 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.
7132 7133 7134 7135 |
# File 'lib/prism/node.rb', line 7132 def ===(other) other.is_a?(FloatNode) && (value === other.value) end |
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void
7080 7081 7082 |
# File 'lib/prism/node.rb', line 7080 def accept(visitor) visitor.visit_float_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array[nil | Node]
7085 7086 7087 |
# File 'lib/prism/node.rb', line 7085 def child_nodes [] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
7095 7096 7097 |
# File 'lib/prism/node.rb', line 7095 def comment_targets [] #: Array[Prism::node | Location] end |
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array
7090 7091 7092 |
# File 'lib/prism/node.rb', line 7090 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
7100 7101 7102 |
# File 'lib/prism/node.rb', line 7100 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 }
7108 7109 7110 |
# File 'lib/prism/node.rb', line 7108 def deconstruct_keys(keys) { node_id: node_id, location: location, value: value } end |
#inspect ⇒ Object
def inspect -> String
7116 7117 7118 |
# File 'lib/prism/node.rb', line 7116 def inspect InspectVisitor.compose(self) end |
#type ⇒ Object
Return a symbol representation of this node type. See ‘Node#type`.
7121 7122 7123 |
# File 'lib/prism/node.rb', line 7121 def type :float_node end |