Skip to content
This repository
Browse code

Adding Ruby 1.9.2 compatibility

  • Loading branch information...
commit 5321c067184b936152d13b573cd86b11eb04a779 1 parent 5af67d3
Jack Danger Canty authored

Showing 1 changed file with 7 additions and 3 deletions. Show diff stats Hide diff stats

  1. +7 3 lib/alphadecimal.rb
10 lib/alphadecimal.rb
... ... @@ -1,9 +1,13 @@
1 1 # coding: utf-8
2 2
3 3 module Alphadecimal
4   - B62_0, B62_9 = '0'.bytes.first, '9'.bytes.first
5   - B62_A, B62_Z = 'A'.bytes.first, 'Z'.bytes.first
6   - B62_a, B62_z = 'a'.bytes.first, 'z'.bytes.first
  4 + def self.char(str)
  5 + str.respond_to?(:ord) ? str.ord : str[0]
  6 + end
  7 +
  8 + B62_0, B62_9 = char('0'), char('9')
  9 + B62_A, B62_Z = char('A'), char('Z')
  10 + B62_a, B62_z = char('a'), char('z')
7 11 B62_CHRS = [(B62_0..B62_9).map{|i|i}, (B62_A..B62_Z).map{|i|i}, (B62_a..B62_z).map{|i|i}].flatten
8 12
9 13 module Number

0 comments on commit 5321c06

Please sign in to comment.
Something went wrong with that request. Please try again.