Class: MiniRuby::AST::IntegerLiteralNode
- Inherits:
-
ExpressionNode
- Object
- Node
- ExpressionNode
- MiniRuby::AST::IntegerLiteralNode
- Defined in:
- lib/miniruby/ast.rb
Overview
Represents an integer literal eg. ‘123`
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) ⇒ IntegerLiteralNode
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) ⇒ IntegerLiteralNode
: (value: String, ?span: Span) -> void
887 888 889 890 |
# File 'lib/miniruby/ast.rb', line 887 def initialize(value:, span: Span::ZERO) @span = span @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
: String
884 885 886 |
# File 'lib/miniruby/ast.rb', line 884 def value @value end |
Instance Method Details
#==(other) ⇒ Object
: (Object other) -> bool
893 894 895 896 897 |
# File 'lib/miniruby/ast.rb', line 893 def ==(other) return false unless other.is_a?(IntegerLiteralNode) @value == other.value end |
#inspect(indent = 0) ⇒ Object
: (?Integer indent) -> String
907 908 909 |
# File 'lib/miniruby/ast.rb', line 907 def inspect(indent = 0) "#{INDENT_UNIT * indent}#{value}" end |
#to_s(indent = 0) ⇒ Object
: (?Integer indent) -> String
901 902 903 |
# File 'lib/miniruby/ast.rb', line 901 def to_s(indent = 0) "#{INDENT_UNIT * indent}#{value}" end |