Class: NexusParser::Tokens::Number

Inherits:
Token
  • Object
show all
Defined in:
lib/nexus_parser/tokens.rb

Instance Attribute Summary

Attributes inherited from Token

#value

Instance Method Summary collapse

Constructor Details

#initialize(str) ⇒ Number

Returns a new instance of Number.



222
223
224
225
226
227
228
229
230
231
# File 'lib/nexus_parser/tokens.rb', line 222

def initialize(str)
  # a little oddness here, in some case we don't want to include the .0
  # see issues with numbers as labels
  if str =~ /\./
    @value = str.to_f
  else
    @value = str.to_i
  end

end