anybase 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/anybase.rb +4 -0
  3. data/spec/util_spec.rb +10 -0
  4. metadata +14 -5
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.8
1
+ 0.0.9
data/lib/anybase.rb CHANGED
@@ -21,6 +21,10 @@ class Anybase
21
21
  @ignore_case
22
22
  end
23
23
 
24
+ def size(digits)
25
+ chars.length ** digits
26
+ end
27
+
24
28
  def random(digits, opts = nil)
25
29
  zero_pad = opts && opts.key?(:zero_pad) ? opts[:zero_pad] : true
26
30
  number = ''
data/spec/util_spec.rb ADDED
@@ -0,0 +1,10 @@
1
+ require 'dirge'
2
+ require ~'spec_helper'
3
+
4
+ describe Anybase, "from" do
5
+ it "should tell you the size for an arbitrary number of digits" do
6
+ Anybase.new("012345678").size(10).should == 3486784401
7
+ (Anybase.new("012345678").size(10) * Anybase.new("012345678").size(10)).should == Anybase.new("012345678").size(20)
8
+ end
9
+
10
+ end
metadata CHANGED
@@ -1,7 +1,12 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: anybase
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 9
9
+ version: 0.0.9
5
10
  platform: ruby
6
11
  authors:
7
12
  - Joshua Hull
@@ -9,7 +14,7 @@ autorequire:
9
14
  bindir: bin
10
15
  cert_chain: []
11
16
 
12
- date: 2010-03-15 00:00:00 -04:00
17
+ date: 2010-05-17 00:00:00 -04:00
13
18
  default_executable:
14
19
  dependencies: []
15
20
 
@@ -30,6 +35,7 @@ files:
30
35
  - spec/spec.opts
31
36
  - spec/spec_helper.rb
32
37
  - spec/to_spec.rb
38
+ - spec/util_spec.rb
33
39
  has_rdoc: true
34
40
  homepage: http://github.com/joshbuddy/anybase
35
41
  licenses: []
@@ -43,18 +49,20 @@ required_ruby_version: !ruby/object:Gem::Requirement
43
49
  requirements:
44
50
  - - ">="
45
51
  - !ruby/object:Gem::Version
52
+ segments:
53
+ - 0
46
54
  version: "0"
47
- version:
48
55
  required_rubygems_version: !ruby/object:Gem::Requirement
49
56
  requirements:
50
57
  - - ">="
51
58
  - !ruby/object:Gem::Version
59
+ segments:
60
+ - 0
52
61
  version: "0"
53
- version:
54
62
  requirements: []
55
63
 
56
64
  rubyforge_project:
57
- rubygems_version: 1.3.5
65
+ rubygems_version: 1.3.6
58
66
  signing_key:
59
67
  specification_version: 3
60
68
  summary: Numbers from anybase to anybase
@@ -62,3 +70,4 @@ test_files:
62
70
  - spec/from_spec.rb
63
71
  - spec/spec_helper.rb
64
72
  - spec/to_spec.rb
73
+ - spec/util_spec.rb