anybase 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/Gemfile +4 -0
- data/Gemfile.lock +24 -0
- data/Rakefile +8 -17
- data/anybase.gemspec +17 -25
- data/lib/anybase/version.rb +1 -1
- data/lib/anybase.rb +2 -2
- data/spec/from_spec.rb +1 -2
- data/spec/spec_helper.rb +4 -1
- data/spec/to_spec.rb +4 -5
- data/spec/util_spec.rb +1 -2
- metadata +44 -48
- data/VERSION +0 -1
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
anybase (0.0.12)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://rubygems.org/
|
8
|
+
specs:
|
9
|
+
diff-lcs (1.1.3)
|
10
|
+
rspec (2.7.0)
|
11
|
+
rspec-core (~> 2.7.0)
|
12
|
+
rspec-expectations (~> 2.7.0)
|
13
|
+
rspec-mocks (~> 2.7.0)
|
14
|
+
rspec-core (2.7.1)
|
15
|
+
rspec-expectations (2.7.0)
|
16
|
+
diff-lcs (~> 1.1.2)
|
17
|
+
rspec-mocks (2.7.0)
|
18
|
+
|
19
|
+
PLATFORMS
|
20
|
+
ruby
|
21
|
+
|
22
|
+
DEPENDENCIES
|
23
|
+
anybase!
|
24
|
+
rspec
|
data/Rakefile
CHANGED
@@ -1,17 +1,8 @@
|
|
1
|
-
require '
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
Spec::Rake::SpecTask.new(:all) do |t|
|
10
|
-
t.spec_opts ||= []
|
11
|
-
t.spec_opts << "-rubygems"
|
12
|
-
t.spec_opts << "--options" << "spec/spec.opts"
|
13
|
-
t.spec_files = FileList['spec/**/*_spec.rb']
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rspec/core/rake_task'
|
3
|
+
|
4
|
+
desc "Run specs"
|
5
|
+
RSpec::Core::RakeTask.new do |t|
|
6
|
+
t.pattern = "./spec/**/*_spec.rb" # don't need this, it's default.
|
7
|
+
# Put spec opts in a file named .rspec in root
|
8
|
+
end
|
data/anybase.gemspec
CHANGED
@@ -1,31 +1,23 @@
|
|
1
|
-
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "anybase/version"
|
2
4
|
|
3
5
|
Gem::Specification.new do |s|
|
4
|
-
s.name
|
5
|
-
s.version
|
6
|
-
|
7
|
-
s.
|
8
|
-
s.
|
9
|
-
s.
|
6
|
+
s.name = "anybase"
|
7
|
+
s.version = Anybase::VERSION
|
8
|
+
s.authors = ["Joshual Hull", "Brad Gessler"]
|
9
|
+
s.email = ["joshbuddy@gmail.com", "brad@bradgessler.com"]
|
10
|
+
s.homepage = "http://github.com/joshbuddy/anybase"
|
11
|
+
s.summary = %q{Numbers from anybase to anybase}
|
10
12
|
s.description = %q{Numbers from anybase to anybase}
|
11
|
-
s.email = %q{joshbuddy@gmail.com}
|
12
|
-
s.extra_rdoc_files = ['README.rdoc']
|
13
|
-
s.files = `git ls-files`.split("\n")
|
14
|
-
s.homepage = %q{http://github.com/joshbuddy/anybase}
|
15
|
-
s.rdoc_options = ["--charset=UTF-8"]
|
16
|
-
s.require_paths = ["lib"]
|
17
|
-
s.rubygems_version = %q{1.3.6}
|
18
|
-
s.summary = %q{Numbers from anybase to anybase}
|
19
|
-
s.test_files = `git ls-files`.split("\n").select{|f| f[/^spec/]}
|
20
13
|
|
21
|
-
|
22
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
23
|
-
s.specification_version = 3
|
14
|
+
s.rubyforge_project = "anybase"
|
24
15
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
30
|
-
end
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
31
20
|
|
21
|
+
# specify any dependencies here; for example:
|
22
|
+
s.add_development_dependency "rspec"
|
23
|
+
end
|
data/lib/anybase/version.rb
CHANGED
data/lib/anybase.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require "anybase/version"
|
2
2
|
|
3
3
|
class Anybase
|
4
4
|
|
@@ -84,7 +84,7 @@ class Anybase
|
|
84
84
|
val /= chars.size
|
85
85
|
str[0, 0] = num_map[digit]
|
86
86
|
end
|
87
|
-
if options && options[:zero_pad]
|
87
|
+
if options && options[:zero_pad] && str.size < options[:zero_pad]
|
88
88
|
str[0, 0] = num_map[0] * (options[:zero_pad] - str.size)
|
89
89
|
end
|
90
90
|
str == '' ? num_map[0].dup : (signed ? @sign.dup << str : str)
|
data/spec/from_spec.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
data/spec/to_spec.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
|
-
require '
|
2
|
-
require ~'spec_helper'
|
1
|
+
require 'spec_helper'
|
3
2
|
|
4
3
|
describe Anybase, "to" do
|
5
4
|
it "should translate base to a number from a string " do
|
@@ -19,9 +18,9 @@ describe Anybase, "to" do
|
|
19
18
|
end
|
20
19
|
|
21
20
|
it "should zeropad" do
|
22
|
-
|
23
|
-
|
24
|
-
|
21
|
+
Anybase.new("012345678").to_native(1234, :zero_pad => 2).should == '1621'
|
22
|
+
Anybase.new("012345678").to_native(1234, :zero_pad => 4).should == '1621'
|
23
|
+
Anybase.new("012345678").to_native(1234, :zero_pad => 8).should == '00001621'
|
25
24
|
end
|
26
25
|
|
27
26
|
it "create random numbers" do
|
data/spec/util_spec.rb
CHANGED
metadata
CHANGED
@@ -1,36 +1,41 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: anybase
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 11
|
10
|
-
version: 0.0.11
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.12
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
13
|
-
-
|
7
|
+
authors:
|
8
|
+
- Joshual Hull
|
9
|
+
- Brad Gessler
|
14
10
|
autorequire:
|
15
11
|
bindir: bin
|
16
12
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
13
|
+
date: 2011-11-18 00:00:00.000000000Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rspec
|
17
|
+
requirement: &70295135181880 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *70295135181880
|
22
26
|
description: Numbers from anybase to anybase
|
23
|
-
email:
|
27
|
+
email:
|
28
|
+
- joshbuddy@gmail.com
|
29
|
+
- brad@bradgessler.com
|
24
30
|
executables: []
|
25
|
-
|
26
31
|
extensions: []
|
27
|
-
|
28
|
-
|
29
|
-
-
|
30
|
-
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- .gitignore
|
35
|
+
- Gemfile
|
36
|
+
- Gemfile.lock
|
31
37
|
- README.rdoc
|
32
38
|
- Rakefile
|
33
|
-
- VERSION
|
34
39
|
- anybase.gemspec
|
35
40
|
- lib/anybase.rb
|
36
41
|
- lib/anybase/version.rb
|
@@ -39,43 +44,34 @@ files:
|
|
39
44
|
- spec/spec_helper.rb
|
40
45
|
- spec/to_spec.rb
|
41
46
|
- spec/util_spec.rb
|
42
|
-
has_rdoc: true
|
43
47
|
homepage: http://github.com/joshbuddy/anybase
|
44
48
|
licenses: []
|
45
|
-
|
46
49
|
post_install_message:
|
47
|
-
rdoc_options:
|
48
|
-
|
49
|
-
require_paths:
|
50
|
+
rdoc_options: []
|
51
|
+
require_paths:
|
50
52
|
- lib
|
51
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
53
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
52
54
|
none: false
|
53
|
-
requirements:
|
54
|
-
- -
|
55
|
-
- !ruby/object:Gem::Version
|
56
|
-
|
57
|
-
|
58
|
-
- 0
|
59
|
-
version: "0"
|
60
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
|
+
requirements:
|
56
|
+
- - ! '>='
|
57
|
+
- !ruby/object:Gem::Version
|
58
|
+
version: '0'
|
59
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
60
|
none: false
|
62
|
-
requirements:
|
63
|
-
- -
|
64
|
-
- !ruby/object:Gem::Version
|
65
|
-
|
66
|
-
segments:
|
67
|
-
- 0
|
68
|
-
version: "0"
|
61
|
+
requirements:
|
62
|
+
- - ! '>='
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
69
65
|
requirements: []
|
70
|
-
|
71
|
-
|
72
|
-
rubygems_version: 1.3.7
|
66
|
+
rubyforge_project: anybase
|
67
|
+
rubygems_version: 1.8.10
|
73
68
|
signing_key:
|
74
69
|
specification_version: 3
|
75
70
|
summary: Numbers from anybase to anybase
|
76
|
-
test_files:
|
71
|
+
test_files:
|
77
72
|
- spec/from_spec.rb
|
78
73
|
- spec/spec.opts
|
79
74
|
- spec/spec_helper.rb
|
80
75
|
- spec/to_spec.rb
|
81
76
|
- spec/util_spec.rb
|
77
|
+
has_rdoc:
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.0.9
|