class Keisan::Tokens::Number
Constants
- BINARY_REGEX
- FLOATING_POINT_REGEX
- HEX_REGEX
- INTEGER_REGEX
- OCTAL_REGEX
- REGEX
- SCIENTIFIC_NOTATION_REGEX
Public Class Methods
regex()
click to toggle source
# File lib/keisan/tokens/number.rb, line 13 def self.regex REGEX end
Public Instance Methods
value()
click to toggle source
# File lib/keisan/tokens/number.rb, line 17 def value case string when /\A#{SCIENTIFIC_NOTATION_REGEX}\z/.freeze, /\A#{FLOATING_POINT_REGEX}\z/.freeze Float(string) else Integer(string) end end