Class: NumberMuncher::Token::Float
- Inherits:
-
Base
- Object
- Base
- NumberMuncher::Token::Float
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
Class Method Details
.regex ⇒ Object
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
12
13
14
|
# File 'lib/number_muncher/token/float.rb', line 12
def float?
true
end
|
#text ⇒ Object
8
9
10
|
# File 'lib/number_muncher/token/float.rb', line 8
def text
super.delete(NumberMuncher.thousands_separator).tr(NumberMuncher.decimal_separator, '.')
end
|