markburns / numbers_in_words

A ruby gem to convert numbers into English words and vice versa.

Home Page:http://rubygems.org/gems/numbers_in_words

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SyntaxError in range

hopewise opened this issue · comments

Hello

When I used ruby 2.4.0, I started getting errors:

/home/deploy/.rvm/gems/ruby-2.4.0/gems/numbers_in_words-0.5.1/lib/numbers_in_words/to_word.rb:4:in `require_relative': /home/deploy/.rvm/gems/ruby-2.4.0/gems/numbers_in_words-0.5.1/lib/numbers_in_words/number_group.rb:48: syntax error, unexpected ']' (SyntaxError)
to_s[(1 - LENGTH_OF_GOOGOL)..].to_i
                              ^

also

/home/deploy/.rvm/gems/ruby-2.4.0/gems/numbers_in_words-0.5.1/lib/numbers_in_words/parsing/number_parser.rb:4:in `require_relative': /home/deploy/.rvm/gems/ruby-2.4.0/gems/numbers_in_words-0.5.1/lib/numbers_in_words/parsing/parse_fractions.rb:30: syntax error, unexpected ']' (SyntaxError)
     nums[index_of_fraction..]
                              ^

however, I got not issue with ruby 2.3.0

Yeah this was auto-corrected code by rubocop. I hadn't looked into the details, are you sure it's that way round? I would have thought that syntax was newer syntax.
There's a PR open #23 that just needs CI config sorting out.
I can have a look myself later tonight and just get it over the line.

Yes, I am sure, the range code has the starting number, but the range end number is missing.

Yeah and the range end number missing must be the newer more flexible ruby syntax. I hadn't encountered it before. Or maybe it is actually old deprecated syntax and I'd just never run into it. Does seem weird for rubocop defaults to recommend it if it is old.

I forgot to look at this but either way I'll investigate later on.

Hey I've now fixed this. Just for the record, it looks like the array[x..] syntax was introduced some time after 2.5.8. So not sure what you were seeing across 2.3.x and 2.4.x

After ten years of development I've finally decided that we can move to a stable 1.0.0 version.

So future breaking changes will follow semantic versioning.