Skip to content

Commit

Permalink
Refactor away from radix's String#b
Browse files Browse the repository at this point in the history
String#b is defined by the radix gem and is also defined in Ruby 2.2.
Let's avoid the conflict.

xref: rubyworks/radix#10
  • Loading branch information
bbasata committed Nov 18, 2017
1 parent e4d141e commit dafbc01
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ source 'https://rubygems.org'

gem 'rails', '~> 4.0.0.beta1'
gem 'pg'
gem 'radix', '~>2.1.1'
gem 'radix', '~>2.1.1', require: 'radix/integer'

gem 'rake', '~>10.0.4'

Expand Down
2 changes: 1 addition & 1 deletion lib/number_encoder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def self.encode(number)
# Ensure that codes are sparse by ensuring the last two characters of the base 'n' number
# are different for encode(n) and encode(n + 1)
number = number * (ALPHABET.length + 1)
number.b(ALPHABET).to_s
Radix::Integer.new(number).to_s(ALPHABET)
end

def self.normalize(code)
Expand Down

0 comments on commit dafbc01

Please sign in to comment.