Class: OboParser::Tokens::Number

Inherits:
Token
  • Object
show all
Defined in:
lib/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.



133
134
135
136
137
138
139
140
141
142
# File 'lib/tokens.rb', line 133

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