Class: NumbersInWords::NumberParser
- Inherits:
-
Object
- Object
- NumbersInWords::NumberParser
- Defined in:
- lib/numbers_in_words/parsing/number_parser.rb
Constant Summary collapse
- SCALES_N =
Example 2001 two thousand and one 2 1000 1
memory answer-
add 2 to memory because first 2 0
-
multiply memory by 1000 because memory < 1000 2000 0
-
add memory to answer,reset, because power of ten>2 0 2000
-
add 1 to memory 1 2000
-
finish - add memory to answer 0 2001
-
[10**2, 10**3, 10**6, 10**9, 10**12, 10**100].freeze
Instance Method Summary collapse
Instance Method Details
#parse(nums, only_compress: false) ⇒ Object
54 55 56 57 58 59 |
# File 'lib/numbers_in_words/parsing/number_parser.rb', line 54 def parse(nums, only_compress: false) fractions(nums) || small_numbers(nums, only_compress) || pair_parsing(nums, only_compress) || parse_each(nums) end |