sixarm_ruby_xid 3.1.0 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7a6cd306d753aa53345165bc0fe03abdb5f32038
4
- data.tar.gz: 2ddb1e1f1c2d577434669f2d2b1f5c77b36b018e
3
+ metadata.gz: 937b657f00fc33f19a4a5b5bacd1c76c27f25746
4
+ data.tar.gz: b5fbbe787c33fdeb8a40cefad62ca454f54d13a8
5
5
  SHA512:
6
- metadata.gz: 5d2072630d29de5205328f7e571a7f5dce56a47b85b001da782f8faaeaf75bca1bfe5366dbfe878b2dab033447f02c0326d0221f1aba8d2275231900b4825122
7
- data.tar.gz: 04e1403dc19e8065b7dd6c237619cbed0ef7714f4db1aaaeed900a8b3cd7b72601aef4870bb4c4fb356038c35838738de34aca3fdff3994704e87a30fcef7064
6
+ metadata.gz: 0a8c2e731f7b725d182a7540293f8188a54d5d551c1ca5945da0d0ed7b83754865e8b8ba88d88a09430ed13e6016c0a547a07089165690ff4b8bf55238b2c1fa
7
+ data.tar.gz: 19ff82defe380b521039b295c13bfc2c76a9c04ffd05b3954980a589542a69eb3259a226a766770cde0c3048231650603bcec55bf2e760f01a6ec33efa8743b1
checksums.yaml.gz.sig CHANGED
Binary file
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # SixArm.com » Ruby » <br> XID excellent identifier
2
2
 
3
- [![Code Climate](https://codeclimate.com/github/SixArm/xid.png)](https://codeclimate.com/github/SixArm/xid)
4
- [![Build Status](https://travis-ci.org/SixArm/xid.png)](https://travis-ci.org/SixArm/xid)
3
+ [![Code Climate](https://codeclimate.com/github/SixArm/xid.png)](https://codeclimate.com/github/SixArm/sixarm_ruby_xid)
4
+ [![Build Status](https://travis-ci.org/SixArm/xid.png)](https://travis-ci.org/SixArm/sixarm_ruby_xid)
5
5
 
6
6
  * Doc: <http://sixarm.com/sixarm_ruby_xid/doc>
7
7
  * Gem: <http://rubygems.org/gems/sixarm_ruby_xid>
@@ -39,7 +39,7 @@ Install:
39
39
 
40
40
  Bundler:
41
41
 
42
- gem "sixarm_ruby_xid", ">=3.0.0", "<4"
42
+ gem "sixarm_ruby_xid", ">=3.1.0", "<4"
43
43
 
44
44
  Require:
45
45
 
@@ -63,8 +63,9 @@ To install with high security:
63
63
 
64
64
  Methods:
65
65
 
66
- * `XID.new`: generate a new XID string
67
- * `XID#digest`: return a SHA256 digest as a 64-character string
66
+ * `XID.new`: create an XID string initialized to a random string.
67
+ * `XID.new(s): create an XID initialized to the given string.
68
+ * `XID#digest`: return a SHA256 digest as a 64-character string.
68
69
 
69
70
  Notes:
70
71
 
@@ -121,7 +122,8 @@ Some databases have specialize fields for 128 bit values, such as PostgreSQL and
121
122
 
122
123
  ## Changes
123
124
 
124
- * 2015-02-11 3.0.0 Upgrade to XID
125
+ * 2015-02-12 3.1.0 Add #digest.
126
+ * 2015-02-11 3.0.0 Upgrade to XID.
125
127
  * 2013-08-20 2.1.0 Add #next to enable using this as an enumeration.
126
128
  * 2013-08-18 2.0.0 Upgrade for Ruby 2.0.0; add .length and .choices methods.
127
129
  * 2012-03-21 1.4.0 Upgrade for Ruby 1.9.3, minitest/spec, and improved docs.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.0.0
1
+ 3.1.0
@@ -8,8 +8,8 @@ require 'digest/sha2'
8
8
 
9
9
  class XID < String
10
10
 
11
- def initialize
12
- super(SecureRandom.hex(16))
11
+ def initialize(s=nil)
12
+ super(s || SecureRandom.hex(16))
13
13
  end
14
14
 
15
15
  def digest
@@ -9,18 +9,31 @@ describe XID do
9
9
 
10
10
  describe "#new" do
11
11
 
12
- it "is a string with the correct length and characters" do
13
- xid = XID.new
14
- xid.must_match /\A[0-9a-f]{32}\z/
15
- end
12
+ describe "with initialize defaults" do
16
13
 
17
- it "is always different" do
18
- seen = Set.new
19
- 99999.times.each{
14
+ it "is a string with the correct length and characters" do
20
15
  xid = XID.new
21
- seen.include?(xid).must_equal false
22
- seen.add(xid)
23
- }
16
+ xid.must_match /\A[0-9a-f]{32}\z/
17
+ end
18
+
19
+ it "is always different" do
20
+ seen = Set.new
21
+ 99999.times.each{
22
+ xid = XID.new
23
+ seen.include?(xid).must_equal false
24
+ seen.add(xid)
25
+ }
26
+ end
27
+
28
+ end
29
+
30
+ describe "with initialize string" do
31
+
32
+ it "sets" do
33
+ xid = XID.new("foo")
34
+ xid.must_equal("foo")
35
+ end
36
+
24
37
  end
25
38
 
26
39
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sixarm_ruby_xid
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.0
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - SixArm
metadata.gz.sig CHANGED
Binary file