rubenum 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +12 -6
- data/lib/rubenum.rb +7 -7
- data/rubenum.gemspec +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 061f383d10f635d645558b3687ccdf3fb2f8ba506a97f139b0522da9448c52fb
|
4
|
+
data.tar.gz: 672eac3c62691e1a83f58246909a70c13396150bf9f9b1b2019c054e792f8bc9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46ea4101ab8079d5e1a5582575c9babc42edbec332ddec5f09e79882b705ee4720c6c00cf479407eda498ef67a9cd0ed465df23ed0f3eebbce400e34f6f73184
|
7
|
+
data.tar.gz: 8cf40f30d6ca4d5a13f04b4506ce6739d18db5fc1d443675381d70d4aaa3a7b64ef3031510b5f14f84267de4c424faacade5ae6a45a0c90db58c275a12a3cdb1
|
data/README.md
CHANGED
@@ -1,15 +1,21 @@
|
|
1
1
|
# Rubenum
|
2
2
|
|
3
|
-
|
3
|
+
Rubenum allows you to create simple enumerations in Ruby.
|
4
4
|
|
5
|
-
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
You can install the Rubenum gem via `gem install rubenum`.
|
8
|
+
|
9
|
+
## Usage
|
10
|
+
|
11
|
+
Create an enumeration from an array of strings with `Rubenum.new`.
|
6
12
|
Only valid Ruby identifiers are accepted.
|
7
|
-
|
13
|
+
By default, every element will be capitalized in order to make valid Ruby constant identifiers.
|
8
14
|
|
9
15
|
### Arguments
|
10
|
-
- elements (array of string) : array containing the elements of the
|
11
|
-
- upcase (boolean
|
12
|
-
- binary_values (boolean
|
16
|
+
- elements (array of string) : array containing the elements of the enumeration
|
17
|
+
- upcase (optional boolean (default:false)) : true => upcase elements' name instead of capitalizing them
|
18
|
+
- binary_values (optional boolean (default:false)) : true => use binary values (1 2 4 8 16 ...) instead of incremental values (1 2 3 4 5 ...)
|
13
19
|
|
14
20
|
### Example
|
15
21
|
e = Rubenum.new(%w[red orange green])
|
data/lib/rubenum.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
-
#
|
1
|
+
# Rubenum allows you to create simple enumerations in Ruby.
|
2
2
|
module Rubenum
|
3
|
-
# Create an
|
4
|
-
# Only valid Ruby identifiers are accepted.
|
5
|
-
#
|
3
|
+
# Create an enumeration from an array of strings with `Rubenum.new`.
|
4
|
+
# Only valid Ruby identifiers are accepted.
|
5
|
+
# By default, every element will be capitalized in order to make valid Ruby constant identifiers.
|
6
6
|
#
|
7
7
|
# Arguments :
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
8
|
+
# - elements (array of string) : array containing the elements of the enumeration
|
9
|
+
# - upcase (optional boolean (default:false)) : true => upcase elements' name instead of capitalizing them
|
10
|
+
# - binary_values (optional boolean (default:false)) : true => use binary values (1 2 4 8 16 ...) instead of incremental values (1 2 3 4 5 ...)
|
11
11
|
#
|
12
12
|
# Example :
|
13
13
|
# e = Rubenum.new(%w[red orange green])
|
data/rubenum.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
2
|
s.name = 'rubenum'
|
3
|
-
s.version = '1.0.
|
4
|
-
s.summary = "
|
3
|
+
s.version = '1.0.1'
|
4
|
+
s.summary = "Rubenum allows you to create simple enumerations in Ruby."
|
5
5
|
s.author = 'Jérémy Blain'
|
6
6
|
s.files = Dir['lib/**/*'] + Dir['test/**/*']
|
7
7
|
s.files += ['LICENSE', 'README.md', 'Rakefile', 'rubenum.gemspec']
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubenum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jérémy Blain
|
@@ -46,5 +46,5 @@ requirements: []
|
|
46
46
|
rubygems_version: 3.0.3
|
47
47
|
signing_key:
|
48
48
|
specification_version: 4
|
49
|
-
summary:
|
49
|
+
summary: Rubenum allows you to create simple enumerations in Ruby.
|
50
50
|
test_files: []
|