micro_token 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/micro_token/version.rb +1 -1
- metadata +3 -4
- data/lib/token.rb +0 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 09c41a2a78efc178460945e450516498f9b0cd60
|
4
|
+
data.tar.gz: ad169551a394ba2b1ba30788fe99a7d97416fece
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f34e869b6dc26d951167544d1b8209f6971f2fb7a29763fca2b4c2c2e46d58b844785a3343d9740b0530bc213c5250148667ec7dc74ad09e642084fd297a5ecc
|
7
|
+
data.tar.gz: 8a73ae42572bf09023cee5215dd2ce529d93a4cc821f1a114898e190373d4f40e4e0bd4fe8bb1694a9f80ae0f36185bb6ccb321e4835ddc4d011d6b358815a7c
|
data/lib/micro_token/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: micro_token
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Harton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-06-
|
11
|
+
date: 2013-06-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -67,7 +67,6 @@ files:
|
|
67
67
|
- Rakefile
|
68
68
|
- lib/micro_token.rb
|
69
69
|
- lib/micro_token/version.rb
|
70
|
-
- lib/token.rb
|
71
70
|
- micro_token.gemspec
|
72
71
|
- spec/lib/micro_token_spec.rb
|
73
72
|
homepage: https://github.com/jamesotron/micro_token
|
@@ -90,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
90
89
|
version: '0'
|
91
90
|
requirements: []
|
92
91
|
rubyforge_project:
|
93
|
-
rubygems_version: 2.0.
|
92
|
+
rubygems_version: 2.0.3
|
94
93
|
signing_key:
|
95
94
|
specification_version: 4
|
96
95
|
summary: A tiny random token generator
|
data/lib/token.rb
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
require 'securerandom'
|
2
|
-
|
3
|
-
class Token
|
4
|
-
ALPHA_CHARS = ('a'..'z').to_a + ('A'..'Z').to_a
|
5
|
-
|
6
|
-
def self.generate(length=8,format=:alphanumeric)
|
7
|
-
(1..length).collect { self.send("_generate_#{format}_char") }.join
|
8
|
-
end
|
9
|
-
|
10
|
-
private
|
11
|
-
|
12
|
-
def self._generate_alphanumeric_char
|
13
|
-
(i = rand(62); i += ((i < 10) ? 48 : ((i < 36) ? 55 : 61 ))).chr
|
14
|
-
end
|
15
|
-
|
16
|
-
def self._generate_numeric_char
|
17
|
-
rand(9)
|
18
|
-
end
|
19
|
-
|
20
|
-
def self._generate_alpha_char
|
21
|
-
ALPHA_CHARS[rand(ALPHA_CHARS.size)]
|
22
|
-
end
|
23
|
-
|
24
|
-
private
|
25
|
-
|
26
|
-
def rand(n)
|
27
|
-
SecureRandom.random_number(n)
|
28
|
-
end
|
29
|
-
end
|