Class: NumberMuncher::Token::Float

Inherits:
Base
  • Object
show all
Defined in:
lib/number_muncher/token/float.rb

Instance Attribute Summary

Attributes inherited from Base

#value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#==, captures, #fraction?, #initialize, #inspect, #int?, scan, #to_a

Constructor Details

This class inherits a constructor from NumberMuncher::Token::Base

Class Method Details

.regexObject



4
5
6
# File 'lib/number_muncher/token/float.rb', line 4

def self.regex
  /(#{Int.regex}|-?)#{Regexp.quote(NumberMuncher.decimal_separator)}\d+/
end

Instance Method Details

#float?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/number_muncher/token/float.rb', line 12

def float?
  true
end

#textObject



8
9
10
# File 'lib/number_muncher/token/float.rb', line 8

def text
  super.delete(NumberMuncher.thousands_separator).tr(NumberMuncher.decimal_separator, '.')
end