Class: Melbourne::AST::Float

Inherits:
Node
  • Object
show all
Defined in:
lib/melbourne/ast/literals.rb

Overview

A float literal as in:

1.2

Instance Attribute Summary collapse

Attributes inherited from Node

#line

Instance Method Summary collapse

Methods inherited from Node

#ascii_graph

Constructor Details

#initialize(line, str) ⇒ Float

Returns a new instance of Float.



56
57
58
59
# File 'lib/melbourne/ast/literals.rb', line 56

def initialize(line, str)
  @line = line
  @value = str.to_f
end

Instance Attribute Details

#valueObject

The actual value of the float literal



54
55
56
# File 'lib/melbourne/ast/literals.rb', line 54

def value
  @value
end