radix icon indicating copy to clipboard operation
radix copied to clipboard

collision String method name "b" with Ruby 2.1

Open JokerCatz opened this issue 11 years ago • 7 comments

sorry for my poor english...

Ruby 2.1.0 String.b #=> http://www.ruby-doc.org/core-2.1.0/String.html#method-i-b

& I tried require(gemfile) radix in rails & use will be fail ~/.rvm/gems/ruby-2.1.0/gems/radix-2.2.0/lib/radix/operator.rb:51:in 'b': wrong number of arguments (0 for 1) (ArgumentError) from ~/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/erb.rb:600:in 'compile' from ~/.rvm/rubies/ruby-2.1.0/lib/ruby/2.1.0/erb.rb:800:in 'initialize'

JokerCatz avatar Feb 05 '14 02:02 JokerCatz

Agreed. The radix gem and Ruby 2.1 are not compatible. Same stacktrace.

hlascelles avatar Feb 13 '14 12:02 hlascelles

What is the best course of action here? Probably to not add that method at all if Ruby is > 2.

hlascelles avatar Feb 13 '14 12:02 hlascelles

I've forked this project, removed the operator.rb, and cut a gem:

gem 'radix-firstbanco'

There's no pull request, as the solution would break all pre Ruby 2.1.0 installations, and Ruby 2.1.0 is broken anyway.

Hopefully the gem authors have a better idea of how to solve this - thank you rubyworks!

hlascelles avatar Feb 14 '14 15:02 hlascelles

Ruby 2.1.1 released.... My forked gem is still required to make Radix work correctly. Hope rubyworks have a plan to resolve the problem?

hlascelles avatar Mar 06 '14 11:03 hlascelles

just fixed this problem by doing: gem 'radix', require: 'radix/integer' and then using Radix::Integer.new(@seed, @alphabet.length).to_s @alphabet instead of @seed.b(@alphabet.length).to_s(@alphabet)

maksar avatar Mar 24 '14 09:03 maksar

Just adding a vote for this to finally get fixed in a official release. In the meantime, I'm using the 'radix-firstbanco' gem.

travisbell avatar Nov 21 '14 16:11 travisbell

Been busy with other work this last year (android development) and just learned about this (unfortunately I don't always get issue emails, not sure why). So I just put in an issue at bugs.ruby-lang.org (https://bugs.ruby-lang.org/issues/10924), asking that the method name be changed. Seems to me an awful name for ascii 8-bit conversion anyway. The obvious choice being #ascii. Of course, I don't have high hopes for my request. They never give me much credence over there. So barring a minor miracle, what is the next best fix? Any ideas?

trans avatar Mar 02 '15 01:03 trans