saikoro 0.1.0 → 0.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: 7440539180cdcac208ba10b16b46a4201f4568bf
4
- data.tar.gz: 1405691f9d716859907961fa429d22777a88bfe3
3
+ metadata.gz: 077f8a22d46491178ed173eef980277f3fb14e0c
4
+ data.tar.gz: d52c9f88c33fc5a797fffa07bfb341dcce415994
5
5
  SHA512:
6
- metadata.gz: 8bf48214acaf78491f3c6f5b1a7bed50e500b14404de60621cf8820c0904810929280ca445df7c29502de336da98b9c79c3dfb0527b29a533aeb497ace93f474
7
- data.tar.gz: 4a6658e1cf4dbc6b8194b694fb5190d5567da79a03a47329684185ae9bd9b93af0f2556f7bf92b1677b01865f050dc56294e1342494fd8992dcb5a9e6706119d
6
+ metadata.gz: cb36915cae8eb1b99e52d6dd168fc0561145e626ecde3817de7301b2fd78d9a4f60b9c18c6a43a80f54db11215dad22920d5cc431f3cf491abb4f1ca853b813b
7
+ data.tar.gz: cbef7c5b9122bedb1c13ac36c4c94feb4f0afd4acee1a7cd8159edd8cf1eab84e85e0a90514d783f0f5abe049852b0caebba5e21bdef8a1f8ed405ebd09ece96
@@ -1,4 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
+ - 2.0.0
3
4
  - 2.2.2
4
5
  before_install: gem install bundler -v 1.10.6
data/README.md CHANGED
@@ -7,28 +7,32 @@ Random String generator.
7
7
 
8
8
  ## Installation
9
9
 
10
- Add this line to your application's Gemfile:
11
-
12
- ```ruby
13
- gem 'saikoro'
14
10
  ```
11
+ $ gem install saikoro
12
+ ```
13
+
14
+ ## Usage
15
15
 
16
- And then execute:
16
+ ```ruby
17
+ require 'saikoro'
17
18
 
18
- $ bundle
19
+ Saikoro.alphanumerics #=> "50UbRceg"
20
+ Saikoro.alphanumerics(length: 42) #=> "gYCEbZubZ1DZpk6Coda0yhFVFQCracACy6dppbwv8H"
19
21
 
20
- Or install it yourself as:
22
+ Saikoro.alphabets #=> "HmQosHQn"
23
+ Saikoro.alphabets(length: 42) #=> "PmbmmJpYUyaTyYqVrNQhzXyDefErYewRhWPNFWIwjV"
21
24
 
22
- $ gem install saikoro
25
+ Saikoro.numbers #=> "98091246"
26
+ Saikoro.numbers(length: 42) #=> "709136609569553516669729349123743566633712"
23
27
 
24
- ## Usage
28
+ Saikoro.ascii_printables #=> "Hh0)S|_<"
29
+ Saikoro.ascii_printables(length: 42) #=> "+;U8-_nDV^&1M!'yKOqD)+(Ju:j`76@a:w-aAwe)]."
25
30
 
26
- ```ruby
27
- Saikoro.alphanumerics
28
- #=> "YMbx24GE"
31
+ Saikoro.lowercase_alphabets #=> "lsiveock"
32
+ Saikoro.lowercase_alphabets(length: 42) #=> "vlwhgsnvyvxhvlstaqtpwfurnpqjpgiitsrweapehl"
29
33
 
30
- Saikoro.alphanumerics(length: 16)
31
- #=> "fAZHtI8bxifylKJf"
34
+ Saikoro.uppercase_alphabets #=> "SAXYNRLK"
35
+ Saikoro.uppercase_alphabets(length: 42) #=> "IWQDNRXXARUKDPVMJBIOXQDRUMUPZWRTFRBNIEUYEK"
32
36
  ```
33
37
 
34
38
  ## Development
@@ -2,14 +2,19 @@ require "saikoro/version"
2
2
 
3
3
  module Saikoro
4
4
  class << self
5
- def alphanumerics(length: 8)
6
- Array.new(length).map { candidates.sample }.join
7
- end
8
-
9
- private
5
+ table = {
6
+ alphanumerics: [*'a'..'z', *'A'..'Z', *'0'..'9'],
7
+ alphabets: [*'a'..'z', *'A'..'Z'],
8
+ lowercase_alphabets: [*'a'..'z'],
9
+ uppercase_alphabets: [*'A'..'Z'],
10
+ numbers: [*'0'..'9'],
11
+ ascii_printables: [*'!'..'~']
12
+ }
10
13
 
11
- def candidates
12
- @candidates ||= ['0'..'9', 'a'..'z', 'A'..'Z'].map(&:to_a).flatten
14
+ table.each do |name, candidates|
15
+ define_method name do |length: 8|
16
+ length.times.map { candidates.sample }.join
17
+ end
13
18
  end
14
19
  end
15
20
  end
@@ -1,3 +1,3 @@
1
1
  module Saikoro
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -16,6 +16,8 @@ Gem::Specification.new do |spec|
16
16
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
17
17
  spec.require_paths = ["lib"]
18
18
 
19
+ spec.required_ruby_version = '>= 2.0.0'
20
+
19
21
  spec.add_development_dependency "bundler", "~> 1.10"
20
22
  spec.add_development_dependency "rake", "~> 10.0"
21
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: saikoro
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tsukuru Tanimichi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-09 00:00:00.000000000 Z
11
+ date: 2015-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,7 +66,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - ">="
68
68
  - !ruby/object:Gem::Version
69
- version: '0'
69
+ version: 2.0.0
70
70
  required_rubygems_version: !ruby/object:Gem::Requirement
71
71
  requirements:
72
72
  - - ">="
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
74
  version: '0'
75
75
  requirements: []
76
76
  rubyforge_project:
77
- rubygems_version: 2.4.5
77
+ rubygems_version: 2.4.5.1
78
78
  signing_key:
79
79
  specification_version: 4
80
80
  summary: Random String generator