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.
-
#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.
7137 7138 7139 7140 7141 7142 7143 |
# File 'lib/prism/node.rb', line 7137 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.
7179 7180 7181 |
# File 'lib/prism/node.rb', line 7179 def value @value end |
Class Method Details
.type ⇒ Object
Return a symbol representation of this node type. See ‘Node::type`.
7192 7193 7194 |
# File 'lib/prism/node.rb', line 7192 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.
7198 7199 7200 7201 |
# File 'lib/prism/node.rb', line 7198 def ===(other) other.is_a?(FloatNode) && (value === other.value) end |
#accept(visitor) ⇒ Object
def accept: (Visitor visitor) -> void
7146 7147 7148 |
# File 'lib/prism/node.rb', line 7146 def accept(visitor) visitor.visit_float_node(self) end |
#child_nodes ⇒ Object Also known as: deconstruct
def child_nodes: () -> Array
7151 7152 7153 |
# File 'lib/prism/node.rb', line 7151 def child_nodes [] end |
#comment_targets ⇒ Object
def comment_targets: () -> Array[Node | Location]
7161 7162 7163 |
# File 'lib/prism/node.rb', line 7161 def comment_targets [] #: Array[Prism::node | Location] end |
#compact_child_nodes ⇒ Object
def compact_child_nodes: () -> Array
7156 7157 7158 |
# File 'lib/prism/node.rb', line 7156 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
7166 7167 7168 |
# File 'lib/prism/node.rb', line 7166 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 }
7174 7175 7176 |
# File 'lib/prism/node.rb', line 7174 def deconstruct_keys(keys) { node_id: node_id, location: location, value: value } end |
#inspect ⇒ Object
def inspect -> String
7182 7183 7184 |
# File 'lib/prism/node.rb', line 7182 def inspect InspectVisitor.compose(self) end |
#type ⇒ Object
Return a symbol representation of this node type. See ‘Node#type`.
7187 7188 7189 |
# File 'lib/prism/node.rb', line 7187 def type :float_node end |