Class: MiniRuby::AST::FloatLiteralNode
- Inherits:
-
ExpressionNode
- Object
- Node
- ExpressionNode
- MiniRuby::AST::FloatLiteralNode
- Defined in:
- lib/miniruby/ast.rb
Overview
Represents a float literal eg. ‘123.5`
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
: String.
Attributes inherited from Node
Instance Method Summary collapse
-
#==(other) ⇒ Object
: (Object other) -> bool.
-
#initialize(value:, span: Span::ZERO) ⇒ FloatLiteralNode
constructor
: (value: String, ?span: Span) -> void.
-
#inspect(indent = 0) ⇒ Object
: (?Integer indent) -> String.
-
#to_s(indent = 0) ⇒ Object
: (?Integer indent) -> String.
Constructor Details
#initialize(value:, span: Span::ZERO) ⇒ FloatLiteralNode
: (value: String, ?span: Span) -> void
856 857 858 859 |
# File 'lib/miniruby/ast.rb', line 856 def initialize(value:, span: Span::ZERO) @span = span @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
: String
853 854 855 |
# File 'lib/miniruby/ast.rb', line 853 def value @value end |
Instance Method Details
#==(other) ⇒ Object
: (Object other) -> bool
862 863 864 865 866 |
# File 'lib/miniruby/ast.rb', line 862 def ==(other) return false unless other.is_a?(FloatLiteralNode) @value == other.value end |
#inspect(indent = 0) ⇒ Object
: (?Integer indent) -> String
876 877 878 |
# File 'lib/miniruby/ast.rb', line 876 def inspect(indent = 0) "#{INDENT_UNIT * indent}#{value}" end |
#to_s(indent = 0) ⇒ Object
: (?Integer indent) -> String
870 871 872 |
# File 'lib/miniruby/ast.rb', line 870 def to_s(indent = 0) "#{INDENT_UNIT * indent}#{value}" end |