randwordjp 0.0.6 → 0.0.7
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/Gemfile +0 -1
- data/lib/randwordjp/version.rb +1 -1
- data/lib/randwordjp.rb +14 -4
- data/randwordjp.gemspec +0 -1
- data/spec/randwordjp_spec.rb +79 -7
- metadata +3 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 70feb1ad06308a9973a08d1efa3ea4d66ba61b73
|
4
|
+
data.tar.gz: 6950bd3c1af8e96de3462b5fab2c148e865850cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81b1e861b22622eaa4149e345bf8d5d468ac295a0207ecbf07c519ccd3acbd10f1ef1a344a791dea61499d40c18bfb49976235d12b916a30f8d4c8aaed250e70
|
7
|
+
data.tar.gz: d60ae98af4e235f25a37657012945c15f5b2d79297c2628db75be671120283b566fe15d581f84d17deaa3a0d4901ea18985ac12774d893303b9bc22309ca1654
|
data/Gemfile
CHANGED
data/lib/randwordjp/version.rb
CHANGED
data/lib/randwordjp.rb
CHANGED
@@ -33,10 +33,15 @@ module Randwordjp
|
|
33
33
|
|
34
34
|
# 全角カタカナの文字列を取得する。
|
35
35
|
# @param [Integer] length 文字列長
|
36
|
+
# @param [Boolean] opt[:old] 旧仮名文字の利用の可否
|
36
37
|
# @return [String] lengthで指定した文字列長の文字列
|
37
|
-
def self.getZenkakuKataKana(length = 10)
|
38
|
+
def self.getZenkakuKataKana(length = 10, opt = {:old => false})
|
38
39
|
words = Array.new()
|
39
|
-
|
40
|
+
if opt[:old]
|
41
|
+
base = ('ア'..'ン').to_a
|
42
|
+
else
|
43
|
+
base = ('ア'..'ン').to_a.join.gsub(/ヰヱ/,"").split(//)
|
44
|
+
end
|
40
45
|
length.times do
|
41
46
|
words << base.sample()
|
42
47
|
end
|
@@ -45,10 +50,15 @@ module Randwordjp
|
|
45
50
|
|
46
51
|
# 全角ひらがなの文字列を取得する。
|
47
52
|
# @param [Integer] length 文字列長
|
53
|
+
# @param [Boolean] opt[:old] 旧仮名文字の利用の可否
|
48
54
|
# @return [String] lengthで指定した文字列長の文字列
|
49
|
-
def self.getZenkakuHiraKana(length = 10 )
|
55
|
+
def self.getZenkakuHiraKana(length = 10 , opt = {:old => false})
|
50
56
|
words = Array.new()
|
51
|
-
|
57
|
+
if opt[:old]
|
58
|
+
base = ('あ'..'ん').to_a
|
59
|
+
else
|
60
|
+
base = ('あ'..'ん').to_a.join.gsub(/ゐゑ/,"").split(//)
|
61
|
+
end
|
52
62
|
length.times do
|
53
63
|
words << base.sample()
|
54
64
|
end
|
data/randwordjp.gemspec
CHANGED
data/spec/randwordjp_spec.rb
CHANGED
@@ -17,16 +17,48 @@ describe Randwordjp do
|
|
17
17
|
expect(Randwordjp.getNumeric(10)).not_to eq(Randwordjp.getNumeric(10))
|
18
18
|
end
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
describe "getZenkakuKatakana" do
|
21
|
+
it 'getZenkakuKataKana length is should have set length' do
|
22
|
+
expect(Randwordjp.getZenkakuKataKana(15).length).to be 15
|
23
|
+
end
|
24
|
+
|
25
|
+
it 'getZenkakuKataKana is should have 全角カタカナ' do
|
26
|
+
expect(Randwordjp.getZenkakuKataKana(10)).to match /[ア-ン]{10}/
|
27
|
+
end
|
28
|
+
|
29
|
+
it 'getZenkakuKataKana is should have ヱヰ , when the old opt is true ' do
|
30
|
+
expect(Randwordjp.getZenkakuKataKana(5000, old: true)).to match /[ヱヰ]/
|
31
|
+
end
|
23
32
|
|
24
|
-
|
25
|
-
|
33
|
+
it 'getZenkakuKataKana is not have ヱヰ , when the old opt is false ' do
|
34
|
+
expect(Randwordjp.getZenkakuKataKana(5000, old: false)).not_to match /[ヱヰ]/
|
35
|
+
end
|
36
|
+
|
37
|
+
it 'getZenkakuKataKana is not should have next time' do
|
38
|
+
expect(Randwordjp.getZenkakuKataKana(10)).not_to eq(Randwordjp.getZenkakuKataKana(10))
|
39
|
+
end
|
26
40
|
end
|
27
41
|
|
28
|
-
|
29
|
-
|
42
|
+
describe "getZenkakuHiraKana" do
|
43
|
+
it 'getZenkakuHiraKana length is should have set length' do
|
44
|
+
expect(Randwordjp.getZenkakuHiraKana(15).length).to be 15
|
45
|
+
end
|
46
|
+
|
47
|
+
it 'getZenkakuHiraKana is should have 全角ひらかな' do
|
48
|
+
expect(Randwordjp.getZenkakuHiraKana(10)).to match /[あ-ん]{10}/
|
49
|
+
end
|
50
|
+
|
51
|
+
it 'getZenkakuHiraKana is should have ゑゐ , when the old opt is true ' do
|
52
|
+
expect(Randwordjp.getZenkakuHiraKana(5000, old: true)).to match /[ゑゐ]/
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'getZenkakuKataKana is not have ゑゐ , when the old opt is false ' do
|
56
|
+
expect(Randwordjp.getZenkakuHiraKana(5000, old: false)).not_to match /[ゑゐ]/
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'getZenkakuHiraKana is not should have next time' do
|
60
|
+
expect(Randwordjp.getZenkakuHiraKana(10)).not_to eq(Randwordjp.getZenkakuHiraKana(10))
|
61
|
+
end
|
30
62
|
end
|
31
63
|
|
32
64
|
it 'getZenkakuAll is not should have next time' do
|
@@ -37,5 +69,45 @@ describe Randwordjp do
|
|
37
69
|
expect(Randwordjp::getTodofuken()).not_to eq(Randwordjp::getTodofuken())
|
38
70
|
end
|
39
71
|
|
72
|
+
describe "getNamae" do
|
73
|
+
it 'getNamae is not null' do
|
74
|
+
expect(Randwordjp::getNamae()).not_to eq nil
|
75
|
+
end
|
76
|
+
|
77
|
+
it 'getNamae have :kana at return hash' do
|
78
|
+
expect(Randwordjp::getNamae()[:kana]).not_to eq nil
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'getNamae have :kanji at return hash' do
|
82
|
+
expect(Randwordjp::getNamae()[:kanji]).not_to eq nil
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'getNamae have :gender at return hash' do
|
86
|
+
expect(Randwordjp::getNamae()[:gender]).not_to eq nil
|
87
|
+
end
|
88
|
+
|
89
|
+
it 'getNamae is not should have next time' do
|
90
|
+
expect(Randwordjp::getNamae().to_s).not_to eq(Randwordjp::getNamae().to_s)
|
91
|
+
end
|
92
|
+
|
93
|
+
end
|
94
|
+
|
95
|
+
describe "getMyoji" do
|
96
|
+
it 'getMyoji is not null' do
|
97
|
+
expect(Randwordjp::getMyoji()).not_to eq nil
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'getMyoji have :kana at return hash' do
|
101
|
+
expect(Randwordjp::getMyoji()[:kana]).not_to eq nil
|
102
|
+
end
|
103
|
+
|
104
|
+
it 'getMyoji have :kanji at return hash' do
|
105
|
+
expect(Randwordjp::getMyoji()[:kanji]).not_to eq nil
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'getMyoji is not should have next time' do
|
109
|
+
expect(Randwordjp::getMyoji().to_s).not_to eq(Randwordjp::getMyoji().to_s)
|
110
|
+
end
|
111
|
+
end
|
40
112
|
end
|
41
113
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: randwordjp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- inpwjp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -52,20 +52,6 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: yaml
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - ">="
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - ">="
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: sqlite3
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,7 +108,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
108
|
version: '0'
|
123
109
|
requirements: []
|
124
110
|
rubyforge_project:
|
125
|
-
rubygems_version: 2.
|
111
|
+
rubygems_version: 2.2.2
|
126
112
|
signing_key:
|
127
113
|
specification_version: 4
|
128
114
|
summary: get Japanese random words.
|