Class: Prism::FloatNode
- Inherits:
-
PrismNode
- Object
- PrismNode
- Prism::FloatNode
- Defined in:
- lib/prism/node.rb,
sig/generated/prism/node.rbs,
ext/prism/api_node.c
Overview
Class Method Summary collapse
-
.type ⇒ :float_node
See
Node.type.
Instance Method Summary collapse
-
#===(other) ⇒ boolish
: (untyped other) -> boolish.
-
#accept(visitor) ⇒ Object
See Node.accept.
-
#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) ⇒ FloatNode
:call-seq: copy(**fields) -> FloatNode.
-
#deconstruct_keys(keys) ⇒ Hash[Symbol, untyped]
: (Array? keys) -> Hash[Symbol, untyped].
-
#each_child_node {|arg0| ... } ⇒ Object
See Node.each_child_node.
-
#initialize(source, node_id, location, flags, value) ⇒ FloatNode
constructor
Initialize a new FloatNode node.
-
#inspect ⇒ String
: () -> String.
-
#type ⇒ :float_node
See
Node#type. -
#value ⇒ Float
:call-seq: value -> Float.
Constructor Details
#initialize(source, node_id, location, flags, value) ⇒ FloatNode
Initialize a new FloatNode node.
: (Source source, Integer node_id, Location location, Integer flags, Float value) -> void
13030 13031 13032 13033 13034 13035 13036 |
# File 'lib/prism/node.rb', line 13030 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 ⇒ :float_node
See Node.type.
: () -> :float_node
13114 13115 13116 |
# File 'lib/prism/node.rb', line 13114 def self.type :float_node end |
Instance Method Details
#===(other) ⇒ boolish
: (untyped other) -> boolish
13140 13141 13142 13143 |
# File 'lib/prism/node.rb', line 13140 def ===(other) # :nodoc: other.is_a?(FloatNode) && (value === other.value) end |
#accept(visitor) ⇒ Object
See Node.accept.
: (_Visitor visitor) -> untyped
13052 13053 13054 |
# File 'lib/prism/node.rb', line 13052 def accept(visitor) visitor.visit_float_node(self) end |
#child_nodes ⇒ Array[node?] Also known as: deconstruct
See Node.child_nodes.
: () -> Array
13059 13060 13061 |
# File 'lib/prism/node.rb', line 13059 def child_nodes [] end |
#compact_child_nodes ⇒ Array[node]
See Node.compact_child_nodes.
: () -> Array
13075 13076 13077 |
# File 'lib/prism/node.rb', line 13075 def compact_child_nodes [] end |
#copy(node_id: self.node_id, location: self.location, flags: self.flags, value: self.value) ⇒ FloatNode
:call-seq:
copy(**fields) -> FloatNode
Creates a copy of self with the given fields, using self as the template.
: (?node_id: Integer, ?location: Location, ?flags: Integer, ?value: Float) -> FloatNode
13085 13086 13087 |
# File 'lib/prism/node.rb', line 13085 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) ⇒ Hash[Symbol, untyped]
: (Array? keys) -> Hash[Symbol, untyped]
13092 13093 13094 13095 13096 13097 13098 13099 13100 13101 13102 |
# File 'lib/prism/node.rb', line 13092 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
13067 13068 13069 13070 |
# File 'lib/prism/node.rb', line 13067 def each_child_node(&blk) return to_enum(:each_child_node) unless block_given? end |
#inspect ⇒ String
: () -> String
13119 13120 13121 |
# File 'lib/prism/node.rb', line 13119 def inspect # :nodoc: InspectVisitor.compose(self) end |
#type ⇒ :float_node
See Node#type.
: () -> :float_node
13107 13108 13109 |
# File 'lib/prism/node.rb', line 13107 def type :float_node end |
#value ⇒ Float
:call-seq:
value -> Float
The value of the floating point number as a Float.
: () -> Float
13131 13132 13133 |
# File 'lib/prism/node.rb', line 13131 def value @value end |