Skip to content

collision String method name "b" with Ruby 2.1 #10

Closed

Description

@JokerCatz

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'

Activity

  1. hlascelles commented on Feb 13, 2014

    @hlascelles

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

  2. hlascelles commented on Feb 13, 2014

    @hlascelles

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

  3. hlascelles commented on Feb 14, 2014

    @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!

  4. hlascelles commented on Mar 6, 2014

    @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?

  5. maksar commented on Mar 24, 2014

    @maksar

    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)

  6. travisbell commented on Nov 21, 2014

    @travisbell

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

  7. trans commented on Mar 2, 2015

    @trans
    Member

    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?

  8. added a commit that references this issue on Nov 18, 2017
  9. trans commented on Nov 17, 2026

    @trans
    Member

    String#b without a base has been Ruby's own method since 2.2.1. As of #16 that is documented in the README and checked by demo/issues/010_string_b.md.

    That is a workaround rather than a fix: Radix still shares the name with a core method. We plan to address the clash itself in a future release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions