rebase 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rebase.rb +5 -2
  3. metadata +3 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2e7840d33f7ac0a5f5d8239eab3a41d819812ee8
4
- data.tar.gz: 331193f87697682d788e41d903f9f95d022693d2
3
+ metadata.gz: d641632580c58d89129f709ce80683e5551351f7
4
+ data.tar.gz: 1061c9faf985ffbfb0e94a60e1dade19705e73f1
5
5
  SHA512:
6
- metadata.gz: 639c131400b69b240130c78db6f4d36b14187375aaed8d92ff1c144ff1b4e3ecce19c4ef1c1ebfbcc40c9086820fa503a8bf3aa675fae5c5c8ff964cd87a0d22
7
- data.tar.gz: ec333a6d2b33fc5bb49f00282de4ff6218b3c482e73048960926c4767b930f5f8181da6f1c8ca7bab13dac72b09b4a77e79433d6013e8b006beb28772c02e069
6
+ metadata.gz: a9a0d7492ca2599e403b752db2557424c19e42f9c212130b21901b6598313f43d62b2e60dc373b0fe41f2226fbfcf434308d823e707cd47a13a05a573111ca6d
7
+ data.tar.gz: 1e2e0a45b72441aef567f8cfdc36d63e43b3fa5c9ddfe61d7a7d33776da6e75bd0b533fe4239e97c6843d1ed9f04c26a8a5a86e77509e6efa7435e9d6721ced2
data/lib/rebase.rb CHANGED
@@ -56,7 +56,7 @@ class Rebase
56
56
 
57
57
  def get_base(int)
58
58
  raise ArgumentError, "Invalid base: #{int}" if int < 2 || int > 62
59
- self.class.const_get("B#{int}")
59
+ (int > 36 ? B62 : B36)[0...int]
60
60
  end
61
61
 
62
62
  B62 = %w[
@@ -65,7 +65,10 @@ class Rebase
65
65
  a b c d e f g h i j k l m n o p q r s t u v w x y z
66
66
  ]
67
67
 
68
- (2...62).map { |i| const_set("B#{i}", B62[0...i]) }
68
+ B36 = %w[
69
+ 0 1 2 3 4 5 6 7 8 9
70
+ a b c d e f g h i j k l m n o p q r s t u v w x y z
71
+ ]
69
72
  end
70
73
 
71
74
  def Rebase(alphabet, int=nil)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rebase
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Larry Fox
@@ -10,8 +10,7 @@ bindir: bin
10
10
  cert_chain: []
11
11
  date: 2014-09-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
- description: Encode and decode from base 10 to string in the given base. Accepts bases
14
- 2—62, or an array of an arbitrary alphabet.
13
+ description: Convert integers to a given base and back again
15
14
  email:
16
15
  - l@rryfox.us
17
16
  executables: []
@@ -45,5 +44,5 @@ rubyforge_project:
45
44
  rubygems_version: 2.4.1
46
45
  signing_key:
47
46
  specification_version: 4
48
- summary: Convert integers to a given base.
47
+ summary: Convert integers to a given base and back again
49
48
  test_files: []