integer-base 0.0.6 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 7923733fdf76c1808180a1ecec081a04c749fb19
4
+ data.tar.gz: c3819b6a8ca68d8e9546fe2708d756d2833b1b0b
5
+ SHA512:
6
+ metadata.gz: c3ef143ec43146201e8a8cf4ccfb197b033c6eb2946b19c6165cd2bd5a994db30f84dc631c4a7e9de92f6c4f02feefba240567ab14c3aeb15d6a000d6f8e6536
7
+ data.tar.gz: c3a2d17291542d24bba94a2d44445f53c5d388c5a25b2ffe55cc920e716e7c573f2a96b6530e772f22b781a1722eb293d493cbac5f5fc8015bb0536815eb1c05
data/.gitignore CHANGED
@@ -1,35 +1,37 @@
1
- *.gem
2
- *.rbc
3
- .bundle
4
- .config
5
- coverage
6
- coverage.data
7
- InstalledFiles
8
- lib/bundler/man
9
- pkg
10
- rdoc
11
- spec/reports
12
- test/tmp
13
- test/version_tmp
14
- tmp
15
-
16
- # bundler
17
- vendor/
18
-
19
- # YARD artifacts
20
- .yardoc
21
- _yardoc
22
- doc/
23
-
24
- # tmp-old
25
- .old
26
-
27
- # editor
28
- *~
29
- .redcar
30
-
31
- # other
32
- *.lock
33
- *.bak
34
- tool/
35
- *\#*
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .ruby-version
6
+ coverage
7
+ coverage.data
8
+ InstalledFiles
9
+ lib/bundler/man
10
+ pkg
11
+ rdoc
12
+ spec/reports
13
+ test/tmp
14
+ test/version_tmp
15
+ tmp
16
+
17
+ # bundler
18
+ vendor/
19
+
20
+ # YARD artifacts
21
+ .yardoc
22
+ _yardoc
23
+ doc/
24
+
25
+ # tmp-old
26
+ .old
27
+
28
+ # editor
29
+ *~
30
+ .redcar
31
+
32
+ # other
33
+ *.lock
34
+ *.bak
35
+ tool/
36
+ *\#*
37
+ .rbx/
@@ -1,14 +1,18 @@
1
- language: ruby
2
- rvm:
3
- - ruby-head
4
- - 1.9.3
5
- - 1.9.2
6
- - rbx-19mode
7
- - jruby-head
8
- - jruby-19mode
9
-
10
- matrix:
11
- allow_failures:
12
- - rvm: rbx-19mode
13
- - rvm: jruby-head
14
- - rvm: jruby-19mode
1
+ language: ruby
2
+
3
+ rvm:
4
+ - ruby-head
5
+ - 2.2
6
+ - 2.1
7
+ - ruby-head
8
+ - rbx-2
9
+ - jruby-head
10
+
11
+ matrix:
12
+ allow_failures:
13
+ - rvm: ruby-head
14
+ - rvm: rbx-2
15
+ - rvm: jruby-head
16
+
17
+ before_install:
18
+ - gem install bundler
data/Gemfile CHANGED
@@ -1,11 +1,11 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
4
-
5
- group :development do
6
- gem 'rake'
7
- end
8
-
9
- group :test do
10
- gem 'rake'
11
- end
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ group :development do
6
+ gem 'rake'
7
+ end
8
+
9
+ group :test do
10
+ gem 'rake'
11
+ end
@@ -1,22 +1,22 @@
1
- (The MIT X11 License)
2
-
3
- Copyright (c) 2011 Kenichi Kamiya
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- 'Software'), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
1
+ (The MIT X11 License)
2
+
3
+ Copyright (c) 2011 Kenichi Kamiya
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ 'Software'), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
19
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
20
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
21
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
22
22
  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,82 +1,80 @@
1
- integer-base
2
- =============
3
-
4
- [![Build Status](https://secure.travis-ci.org/kachick/integer-base.png)](http://travis-ci.org/kachick/integer-base)
5
-
6
- Description
7
- -----------
8
-
9
- Any formats can mean positional/unary numeral systems :)
10
- So base number conversion under your choise.
11
-
12
- Features
13
- --------
14
-
15
- * You can easily build base numbers.
16
- * An example, upper the "36".
17
-
18
- Usage
19
- -----
20
-
21
- ### Introduction
22
-
23
- ```ruby
24
- require 'integer/base'
25
-
26
- Integer::Base.parse '10', %w[0 1 2 3 4 5 6 7 8 9] #=> 10
27
- Integer::Base.parse '10', %w[0 1] #=> 2
28
- Integer::Base.string_for 10, %w[0 1] #=> '2'
29
-
30
-
31
- require 'integer/base/core_ext'
32
-
33
- '10'.to_i %w[0 1] #=> 2
34
- 10.to_s %w[0 1] #=> "2"
35
- ```
36
-
37
- ### Upper 36 base number
38
-
39
- ```ruby
40
- '10'.to_i 36 #=> 36
41
- '10'.to_i [*'0'..'9', *'A'..'Z'] #=> 36
42
- '10'.to_i 37 #=> ArgumentError
43
- '10'.to_i [*'0'..'9', *'A'..'Z', '?'] #=> 37
44
- '1?'.to_s [*'0'..'9', *'A'..'Z', '?'] #=> '73' (37 * 1 + 36 * 1)
45
- ```
46
-
47
- ### Let's begin, your strange base number.
48
-
49
- ```ruby
50
-
51
- ':)'.to_i %w[) :] #=> 2
52
-
53
- ```
54
-
55
- Requirements
56
- -------------
57
-
58
- * [Ruby 1.9.2 or later](http://travis-ci.org/#!/kachick/integer-base)
59
-
60
- Install
61
- -------
62
-
63
- ```bash
64
- $ gem install integer-base
65
- ```
66
-
67
- Link
68
- ----
69
-
70
- * [code](https://github.com/kachick/integer-base)
71
- * [API](http://kachick.github.com/docs/integer-base/api/frames.html)
72
- * [issues](https://github.com/kachick/integer-base/issues)
73
- * [CI](http://travis-ci.org/#!/kachick/integer-base)
74
- * [gem](https://rubygems.org/gems/integer-base)
75
-
76
- License
77
- --------
78
-
79
- The MIT X11 License
80
- Copyright (c) 2011 Kenichi Kamiya
81
- See the file LICENSE for further details.
82
-
1
+ integer-base
2
+ =============
3
+
4
+ [![Build Status](https://secure.travis-ci.org/kachick/integer-base.png)](http://travis-ci.org/kachick/integer-base)
5
+ [![Gem Version](https://badge.fury.io/rb/integer-base.png)](http://badge.fury.io/rb/integer-base)
6
+ [![Dependency Status](https://gemnasium.com/kachick/integer-base.svg)](https://gemnasium.com/kachick/integer-base)
7
+
8
+ Description
9
+ -----------
10
+
11
+ Any formats can mean positional/unary numeral systems :)
12
+ So base number conversion under your choice.
13
+
14
+ Features
15
+ --------
16
+
17
+ * You can easily build base numbers.
18
+ * An example, upper the "36".
19
+
20
+ Usage
21
+ -----
22
+
23
+ ### Introduction
24
+
25
+ ```ruby
26
+ require 'integer/base'
27
+
28
+ Integer::Base.parse '10', %w[0 1 2 3 4 5 6 7 8 9] #=> 10
29
+
30
+
31
+ using Integer::Base
32
+
33
+ '10'.to_i %w[0 1] #=> 2
34
+ 10.to_s %w[0 1] #=> "2"
35
+ ```
36
+
37
+ ### Upper 36 base number
38
+
39
+ ```ruby
40
+ '10'.to_i 36 #=> 36
41
+ '10'.to_i [*'0'..'9', *'A'..'Z'] #=> 36
42
+ '10'.to_i 37 #=> ArgumentError
43
+ '10'.to_i [*'0'..'9', *'A'..'Z', '?'] #=> 37
44
+ '1?'.to_i [*'0'..'9', *'A'..'Z', '?'] #=> 73 (37 * 1 + 36 * 1)
45
+ ```
46
+
47
+ ### Let's begin, your strange base number.
48
+
49
+ ```ruby
50
+
51
+ ':)'.to_i %w[) :] #=> 2
52
+ ```
53
+
54
+ Requirements
55
+ -------------
56
+
57
+ * [Ruby 2.1 or later](http://travis-ci.org/#!/kachick/integer-base)
58
+
59
+ Install
60
+ -------
61
+
62
+ ```bash
63
+ $ gem install integer-base
64
+ ```
65
+
66
+ Link
67
+ ----
68
+
69
+ * [code](https://github.com/kachick/integer-base)
70
+ * [API](http://www.rubydoc.info/github/kachick/integer-base)
71
+ * [issues](https://github.com/kachick/integer-base/issues)
72
+ * [CI](http://travis-ci.org/#!/kachick/integer-base)
73
+ * [gem](https://rubygems.org/gems/integer-base)
74
+
75
+ License
76
+ --------
77
+
78
+ The MIT X11 License
79
+ Copyright (c) 2011 Kenichi Kamiya
80
+ See MIT-LICENSE for further details.
data/Rakefile CHANGED
@@ -1,11 +1,12 @@
1
- #!/usr/bin/env rake
2
- require 'bundler/gem_tasks'
3
-
4
- require 'rake/testtask'
5
-
6
- task default: [:test]
7
-
8
- Rake::TestTask.new do |tt|
9
- tt.pattern = 'test/**/test_*.rb'
10
- tt.verbose = true
11
- end
1
+ #!/usr/bin/env rake
2
+ require 'bundler/gem_tasks'
3
+
4
+ require 'rake/testtask'
5
+
6
+ task default: [:test]
7
+
8
+ Rake::TestTask.new do |tt|
9
+ tt.pattern = 'test/**/test_*.rb'
10
+ tt.verbose = true
11
+ tt.warning = true
12
+ end
@@ -0,0 +1,24 @@
1
+ # coding: us-ascii
2
+
3
+ require_relative '../lib/integer/base'
4
+
5
+ Integer::Base.parse '10', %w[0 1 2 3 4 5 6 7 8 9] #=> 10
6
+ Integer::Base.parse '10', %w[0 1] #=> 2
7
+ Integer::Base.string_for 10, %w[0 1] #=> '2'
8
+
9
+ using Integer::Base
10
+
11
+ '10'.to_i %w[0 1] #=> 2
12
+ 10.to_s %w[0 1] #=> "2"
13
+
14
+ ### Upper 36 base number
15
+
16
+ '10'.to_i 36 #=> 36
17
+ '10'.to_i [*'0'..'9', *'A'..'Z'] #=> 36
18
+ # '10'.to_i 37 #=> ArgumentError
19
+ '10'.to_i [*'0'..'9', *'A'..'Z', '?'] #=> 37
20
+ '1?'.to_i [*'0'..'9', *'A'..'Z', '?'] #=> 73 (37 * 1 + 36 * 1)
21
+
22
+ ### Let's begin, your strange base number.
23
+
24
+ ':)'.to_i %w[) :]
@@ -1,21 +1,36 @@
1
- require File.expand_path('../lib/integer/base/version', __FILE__)
2
-
3
- Gem::Specification.new do |gem|
4
- gem.authors = ['Kenichi Kamiya']
5
- gem.email = ['kachick1+ruby@gmail.com']
6
- gem.description = %q{Any formats can mean positional/unary numeral systems :)}
7
- gem.summary = %q{Any formats can mean positional/unary numeral systems :)}
8
- gem.homepage = 'https://github.com/kachick/integer-base'
9
-
10
- gem.files = `git ls-files`.split($\)
11
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
12
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
13
- gem.name = 'integer-base'
14
- gem.require_paths = ['lib']
15
- gem.version = Integer::Base::VERSION.dup # dup for https://github.com/rubygems/rubygems/commit/48f1d869510dcd325d6566df7d0147a086905380#-P0
16
-
17
- gem.required_ruby_version = '>= 1.9.2'
18
-
19
- gem.add_development_dependency 'yard', '>= 0.8.2.1'
20
- end
21
-
1
+ # coding: us-ascii
2
+
3
+ lib_name = 'integer-base'.freeze
4
+
5
+ require File.expand_path('../lib/integer/base/version', __FILE__)
6
+
7
+ Gem::Specification.new do |gem|
8
+ gem.authors = ['Kenichi Kamiya']
9
+ gem.email = ['kachick1+ruby@gmail.com']
10
+ gem.description = %q{Any formats can mean positional/unary numeral systems :)
11
+ So base number conversion under your choise.}
12
+ gem.summary = %q{Any formats can mean positional/unary numeral systems :)}
13
+
14
+ gem.summary = gem.description.dup
15
+ gem.homepage = "https://github.com/kachick/#{lib_name}"
16
+ gem.license = 'MIT'
17
+ gem.name = lib_name.dup
18
+ # dup for https://github.com/rubygems/rubygems/commit/48f1d869510dcd325d6566df7d0147a086905380#-P0
19
+ gem.version = Integer::Base::VERSION.dup
20
+
21
+ gem.required_ruby_version = '>= 2.1'
22
+
23
+ gem.add_development_dependency 'test-unit', '>= 3.1.1', '< 4'
24
+ gem.add_development_dependency 'yard', '>= 0.8.7.6', '< 0.9'
25
+ gem.add_development_dependency 'rake', '>= 10', '< 20'
26
+ gem.add_development_dependency 'bundler', '>= 1.10', '< 2'
27
+
28
+ # common
29
+
30
+ gem.authors = ['Kenichi Kamiya']
31
+ gem.email = ['kachick1+ruby@gmail.com']
32
+ gem.files = `git ls-files`.split($\)
33
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
34
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
35
+ gem.require_paths = ['lib']
36
+ end