gimei 0.3.0 → 0.4.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
- SHA1:
3
- metadata.gz: 1605b3bfbb543f4f1a38f3400377fe855ea2bc0d
4
- data.tar.gz: c1781dab9fe9506476f85a9254796f00b042d912
2
+ SHA256:
3
+ metadata.gz: 35cb5bc32bc45d0b86828d6752260ea90a70c7fdd4151bd0e425425eee7cb8ca
4
+ data.tar.gz: a3cbf8105592bbd8bb38753bfa5acca44ceea9675ffe9963e89dd74ab91f8e04
5
5
  SHA512:
6
- metadata.gz: 47f890c91bfc8b1b9a73a7fbe4d9d1b39880da1d7dca12c44e87676ddcfd7b0b0acca8dc2b507929154a4baae87c6288c42723db67204c3cdfdc23f87eb95c43
7
- data.tar.gz: e113e8752c3a5c2def53b8c3bc0530b30efbdc705f79f01e385937eb7438156aaedc9c46fe77c420f6d9f77801b51cafcd1cb851005a238a736cb857d39cc7a7
6
+ metadata.gz: 07b60a6af8982950d8786c4ee4a8d2522b4e2381e70c73e9c686238818b3117ecce405aeae08a1334d32e774caaf23e18ce0f21a6ed017679306c701415e50dc
7
+ data.tar.gz: b7fcac6a4a5101ba31053153b274c0994b4b27bdf453c370ab4fa50cbde32c361357e05e4a865deb5631e316b2af7737442f03a55ef28bd8c8a207b04e909819
@@ -1,10 +1,13 @@
1
1
  language: ruby
2
2
  rvm:
3
- - "1.9.3"
4
3
  - "2.0.0"
5
4
  - "2.1.10"
6
5
  - "2.2.7"
7
6
  - "2.3.4"
8
7
  - "2.4.1"
8
+ - "2.5.0"
9
+ - "2.6.0"
10
+ - "2.7.0"
11
+
9
12
  before_install:
10
13
  - gem update bundler
@@ -1,3 +1,9 @@
1
+ ## 0.4.0
2
+
3
+ * Gimei#genderメソッドの追加 - [@nard-tech](https://github.com/nard-tech)
4
+ * Ruby 1.9のサポートの停止
5
+ * Ruby 2.7をサポート開始
6
+
1
7
  ## 0.3.0
2
8
 
3
9
  * ローマ字対応 - [@takkanm](https://github.com/takkanm)
data/README.md CHANGED
@@ -20,6 +20,9 @@ gimei.kanji #=> "斎藤 陽菜"
20
20
  gimei.hiragana #=> "さいとう はるな"
21
21
  gimei.katakana #=> "サイトウ ハルナ"
22
22
  gimei.romaji #=> "Haruna Saitou"
23
+ gimei.gender #=> :female
24
+ gimei.male? #=> false
25
+ gimei.female? #=> true
23
26
  gimei.last.kanji #=> "斎藤"
24
27
  gimei.last.hiragana #=> "さいとう"
25
28
  gimei.last.katakana #=> "サイトウ"
@@ -36,11 +39,13 @@ gimei.first.romaji #=> "Haruna"
36
39
  gimei = Gimei.male
37
40
  gimei.male? #=> true
38
41
  gimei.female? #=> false
42
+ gimei.gender #=> :male
39
43
  gimei.kanji #=> "小林 顕士"
40
44
 
41
45
  gimei = Gimei.female
42
46
  gimei.male? #=> false
43
47
  gimei.female? #=> true
48
+ gimei.gender #=> :female
44
49
  gimei.kanji #=> "根本 彩世"
45
50
  ```
46
51
 
@@ -119,12 +124,14 @@ Gimei.town.romaji # => Heisei
119
124
 
120
125
  ## Supported versions
121
126
 
122
- - 1.9.3
123
127
  - 2.0.0
124
128
  - 2.1.x
125
129
  - 2.2.x
126
130
  - 2.3.x
127
131
  - 2.4.x
132
+ - 2.5.x
133
+ - 2.6.x
134
+ - 2.7.x
128
135
 
129
136
  ## 他言語による実装
130
137
 
@@ -134,6 +141,8 @@ Gimei.town.romaji # => Heisei
134
141
  - [gongo/emacs-gimei](https://github.com/gongo/emacs-gimei)
135
142
  - [ma2gedev/gimei_ex](https://github.com/ma2gedev/gimei_ex)
136
143
  - [demiglacesource/node-gimei](https://github.com/demiglacesource/node-gimei)
144
+ - [matarillo/dot-gimei](https://github.com/matarillo/dot-gimei)
145
+ - [abcb2/type-gimei](https://github.com/abcb2/type-gimei)
137
146
 
138
147
  ## Installation
139
148
 
@@ -9,9 +9,9 @@ class Gimei
9
9
 
10
10
  NAMES = YAML.load_file(File.expand_path(File.join('..', 'data', 'names.yml'), __FILE__))
11
11
  ADDRESSES = YAML.load_file(File.expand_path(File.join('..', 'data', 'addresses.yml'), __FILE__))
12
- GENDER = [:male, :female].freeze
12
+ GENDERS = [:male, :female].freeze
13
13
 
14
- def_delegators :@name, :kanji, :hiragana, :katakana, :first, :last, :male?, :female?, :romaji
14
+ def_delegators :@name, :gender, :kanji, :hiragana, :katakana, :first, :last, :male?, :female?, :romaji
15
15
  def_delegators :@address, :prefecture, :city, :town
16
16
  alias_method :to_s, :kanji
17
17
 
@@ -1,7 +1,7 @@
1
1
  require 'romaji'
2
2
 
3
3
  class Gimei::Name
4
- attr_reader :first, :last
4
+ attr_reader :first, :last, :gender
5
5
 
6
6
  class << self
7
7
  extend Forwardable
@@ -17,7 +17,7 @@ class Gimei::Name
17
17
  end
18
18
 
19
19
  def initialize(gender = nil)
20
- @gender = gender || Gimei::GENDER.sample
20
+ @gender = gender || Gimei::GENDERS.sample
21
21
  @first = First.new @gender
22
22
  @last = Last.new
23
23
  end
@@ -63,7 +63,7 @@ class Gimei::Name
63
63
  def_delegators :@name, :kanji, :hiragana, :katakana, :to_s, :romaji
64
64
 
65
65
  def initialize(gender = nil)
66
- @gender = gender || Gimei::GENDER.sample
66
+ @gender = gender || Gimei::GENDERS.sample
67
67
  @name = NameWord.new(Gimei::NAMES['first_name'][@gender.to_s].sample)
68
68
  end
69
69
 
@@ -1,3 +1,3 @@
1
1
  class Gimei
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.0"
3
3
  end
@@ -4,61 +4,61 @@ require_relative 'spec_helper'
4
4
  describe Gimei do
5
5
  describe '#kanji and #to_s' do
6
6
  it '全角文字が返ること' do
7
- Gimei.address.kanji.must_match(/\A[#{Moji.zen}]+\z/)
8
- Gimei.address.to_s.must_match(/\A[#{Moji.zen}]+\z/)
9
- Gimei.address.prefecture.kanji.must_match(/\A[#{Moji.zen}]+\z/)
10
- Gimei.address.prefecture.to_s.must_match(/\A[#{Moji.zen}]+\z/)
11
- Gimei.address.city.kanji.must_match(/\A[#{Moji.zen}]+\z/)
12
- Gimei.address.city.to_s.must_match(/\A[#{Moji.zen}]+\z/)
13
- Gimei.address.town.kanji.must_match(/\A[#{Moji.zen}]+\z/)
14
- Gimei.address.town.to_s.must_match(/\A[#{Moji.zen}]+\z/)
7
+ _(Gimei.address.kanji).must_match(/\A[#{Moji.zen}]+\z/)
8
+ _(Gimei.address.to_s).must_match(/\A[#{Moji.zen}]+\z/)
9
+ _(Gimei.address.prefecture.kanji).must_match(/\A[#{Moji.zen}]+\z/)
10
+ _(Gimei.address.prefecture.to_s).must_match(/\A[#{Moji.zen}]+\z/)
11
+ _(Gimei.address.city.kanji).must_match(/\A[#{Moji.zen}]+\z/)
12
+ _(Gimei.address.city.to_s).must_match(/\A[#{Moji.zen}]+\z/)
13
+ _(Gimei.address.town.kanji).must_match(/\A[#{Moji.zen}]+\z/)
14
+ _(Gimei.address.town.to_s).must_match(/\A[#{Moji.zen}]+\z/)
15
15
 
16
- Gimei.prefecture.kanji.must_match(/\A[#{Moji.zen}]+\z/)
17
- Gimei.prefecture.to_s.must_match(/\A[#{Moji.zen}]+\z/)
18
- Gimei.city.kanji.must_match(/\A[#{Moji.zen}]+\z/)
19
- Gimei.city.to_s.must_match(/\A[#{Moji.zen}]+\z/)
20
- Gimei.town.kanji.must_match(/\A[#{Moji.zen}]+\z/)
21
- Gimei.town.to_s.must_match(/\A[#{Moji.zen}]+\z/)
16
+ _(Gimei.prefecture.kanji).must_match(/\A[#{Moji.zen}]+\z/)
17
+ _(Gimei.prefecture.to_s).must_match(/\A[#{Moji.zen}]+\z/)
18
+ _(Gimei.city.kanji).must_match(/\A[#{Moji.zen}]+\z/)
19
+ _(Gimei.city.to_s).must_match(/\A[#{Moji.zen}]+\z/)
20
+ _(Gimei.town.kanji).must_match(/\A[#{Moji.zen}]+\z/)
21
+ _(Gimei.town.to_s).must_match(/\A[#{Moji.zen}]+\z/)
22
22
  end
23
23
  end
24
24
 
25
25
  describe '#hiragana' do
26
26
  it 'ひらがなが返ること' do
27
- Gimei.address.hiragana.must_match(/\A[\p{hiragana}]+\z/)
28
- Gimei.address.prefecture.hiragana.must_match(/\A[\p{hiragana}]+\z/)
29
- Gimei.address.city.hiragana.must_match(/\A[\p{hiragana}]+\z/)
30
- Gimei.address.town.hiragana.must_match(/\A[\p{hiragana}]+\z/)
27
+ _(Gimei.address.hiragana).must_match(/\A[\p{hiragana}]+\z/)
28
+ _(Gimei.address.prefecture.hiragana).must_match(/\A[\p{hiragana}]+\z/)
29
+ _(Gimei.address.city.hiragana).must_match(/\A[\p{hiragana}]+\z/)
30
+ _(Gimei.address.town.hiragana).must_match(/\A[\p{hiragana}]+\z/)
31
31
 
32
- Gimei.prefecture.hiragana.must_match(/\A[\p{hiragana}]+\z/)
33
- Gimei.city.hiragana.must_match(/\A[\p{hiragana}]+\z/)
34
- Gimei.town.hiragana.must_match(/\A[\p{hiragana}]+\z/)
32
+ _(Gimei.prefecture.hiragana).must_match(/\A[\p{hiragana}]+\z/)
33
+ _(Gimei.city.hiragana).must_match(/\A[\p{hiragana}]+\z/)
34
+ _(Gimei.town.hiragana).must_match(/\A[\p{hiragana}]+\z/)
35
35
  end
36
36
  end
37
37
 
38
38
  describe '#katakana' do
39
39
  it 'カタカナが返ること' do
40
- Gimei.address.katakana.must_match(/\A[\p{katakana}]+\z/)
41
- Gimei.address.prefecture.katakana.must_match(/\A[\p{katakana}]+\z/)
42
- Gimei.address.city.katakana.must_match(/\A[\p{katakana}]+\z/)
43
- Gimei.address.town.katakana.must_match(/\A[\p{katakana}]+\z/)
40
+ _(Gimei.address.katakana).must_match(/\A[\p{katakana}]+\z/)
41
+ _(Gimei.address.prefecture.katakana).must_match(/\A[\p{katakana}]+\z/)
42
+ _(Gimei.address.city.katakana).must_match(/\A[\p{katakana}]+\z/)
43
+ _(Gimei.address.town.katakana).must_match(/\A[\p{katakana}]+\z/)
44
44
 
45
- Gimei.prefecture.katakana.must_match(/\A[\p{katakana}]+\z/)
46
- Gimei.city.katakana.must_match(/\A[\p{katakana}]+\z/)
47
- Gimei.town.katakana.must_match(/\A[\p{katakana}]+\z/)
45
+ _(Gimei.prefecture.katakana).must_match(/\A[\p{katakana}]+\z/)
46
+ _(Gimei.city.katakana).must_match(/\A[\p{katakana}]+\z/)
47
+ _(Gimei.town.katakana).must_match(/\A[\p{katakana}]+\z/)
48
48
  end
49
49
  end
50
50
 
51
51
  describe '#romaji' do
52
52
  it 'ローマ字が返ること' do
53
- Gimei.address.romaji.must_match(/\A[a-zA-Z\s]+\z/)
53
+ _(Gimei.address.romaji).must_match(/\A[a-zA-Z\s]+\z/)
54
54
 
55
- Gimei.address.prefecture.romaji.must_match(/\A[a-zA-Z]+\z/)
56
- Gimei.address.city.romaji.must_match(/\A[a-zA-Z]+\z/)
57
- Gimei.address.town.romaji.must_match(/\A[a-zA-Z]+\z/)
55
+ _(Gimei.address.prefecture.romaji).must_match(/\A[a-zA-Z]+\z/)
56
+ _(Gimei.address.city.romaji).must_match(/\A[a-zA-Z]+\z/)
57
+ _(Gimei.address.town.romaji).must_match(/\A[a-zA-Z]+\z/)
58
58
 
59
- Gimei.prefecture.romaji.must_match(/\A[a-zA-Z]+\z/)
60
- Gimei.city.romaji.must_match(/\A[a-zA-Z]+\z/)
61
- Gimei.town.romaji.must_match(/\A[a-zA-Z]+\z/)
59
+ _(Gimei.prefecture.romaji).must_match(/\A[a-zA-Z]+\z/)
60
+ _(Gimei.city.romaji).must_match(/\A[a-zA-Z]+\z/)
61
+ _(Gimei.town.romaji).must_match(/\A[a-zA-Z]+\z/)
62
62
  end
63
63
  end
64
64
  end
@@ -6,11 +6,15 @@ describe Gimei do
6
6
  before { @name = Gimei.male }
7
7
 
8
8
  it 'Gimei::Name オブジェクトが返ること' do
9
- @name.must_be_instance_of Gimei::Name
9
+ _(@name).must_be_instance_of Gimei::Name
10
+ end
11
+
12
+ it '#gender が :male を返すこと' do
13
+ _(@name.gender).must_equal :male
10
14
  end
11
15
 
12
16
  it '#male? が true を返すこと' do
13
- @name.male?.must_equal true
17
+ _(@name.male?).must_equal true
14
18
  end
15
19
  end
16
20
 
@@ -18,149 +22,160 @@ describe Gimei do
18
22
  before { @name = Gimei.female }
19
23
 
20
24
  it 'Gimei::Name オブジェクトが返ること' do
21
- @name.must_be_instance_of Gimei::Name
25
+ _(@name).must_be_instance_of Gimei::Name
26
+ end
27
+
28
+ it '#gender が :female を返すこと' do
29
+ _(@name.gender).must_equal :female
22
30
  end
23
31
 
24
32
  it '#female? が true を返すこと' do
25
- @name.female?.must_equal true
33
+ _(@name.female?).must_equal true
34
+ end
35
+ end
36
+
37
+ describe '#gender' do
38
+ it ':male または :female が返ること' do
39
+ _(Gimei.new.gender).must_be_instance_of(Symbol)
40
+ _(Gimei.new.gender.to_s).must_match(/\A(?:male|female)\Z/)
26
41
  end
27
42
  end
28
43
 
29
44
  describe '#kanji' do
30
45
  it '全角文字とスペースが返ること' do
31
- Gimei.new.kanji.must_match /\A[#{Moji.zen}\s]+\z/
46
+ _(Gimei.new.kanji).must_match(/\A[#{Moji.zen}\s]+\z/)
32
47
  end
33
48
  end
34
49
 
35
50
  describe '#to_s' do
36
51
  it '全角文字とスペースが返ること' do
37
- Gimei.new.to_s.must_match /\A[#{Moji.zen}\s]+\z/
52
+ _(Gimei.new.to_s).must_match(/\A[#{Moji.zen}\s]+\z/)
38
53
  end
39
54
  end
40
55
 
41
56
  describe '.kanji' do
42
57
  it '全角文字とスペースが返ること' do
43
- Gimei.kanji.must_match /\A[#{Moji.zen}\s]+\z/
58
+ _(Gimei.kanji).must_match(/\A[#{Moji.zen}\s]+\z/)
44
59
  end
45
60
  end
46
61
 
47
62
  describe '#hiragana' do
48
63
  it 'ひらがなとスペースが返ること' do
49
- Gimei.new.hiragana.must_match /\A[\p{hiragana}\s]+\z/
64
+ _(Gimei.new.hiragana).must_match(/\A[\p{hiragana}\s]+\z/)
50
65
  end
51
66
  end
52
67
 
53
68
  describe '.hiragana' do
54
69
  it 'ひらがなとスペースが返ること' do
55
- Gimei.hiragana.must_match /\A[\p{hiragana}\s]+\z/
70
+ _(Gimei.hiragana).must_match(/\A[\p{hiragana}\s]+\z/)
56
71
  end
57
72
  end
58
73
 
59
74
  describe '#katakana' do
60
75
  it 'カタカナとスペースが返ること' do
61
- Gimei.new.katakana.must_match /\A[\p{katakana}\s]+\z/
76
+ _(Gimei.new.katakana).must_match(/\A[\p{katakana}\s]+\z/)
62
77
  end
63
78
  end
64
79
 
65
80
  describe '.katakana' do
66
81
  it 'カタカナとスペースが返ること' do
67
- Gimei.katakana.must_match /\A[\p{katakana}\s]+\z/
82
+ _(Gimei.katakana).must_match(/\A[\p{katakana}\s]+\z/)
68
83
  end
69
84
  end
70
85
 
71
86
  describe '.name' do
72
87
  it 'Gimei::Name オブジェクトが返ること' do
73
- Gimei.name.must_be_instance_of Gimei::Name
88
+ _(Gimei.name).must_be_instance_of Gimei::Name
74
89
  end
75
90
  end
76
91
 
77
92
  describe '#name' do
78
93
  it 'Gimei::Name オブジェクトが返ること' do
79
- Gimei.new.name.must_be_instance_of Gimei::Name
94
+ _(Gimei.new.name).must_be_instance_of Gimei::Name
80
95
  end
81
96
  end
82
97
 
83
98
  describe '.first' do
84
99
  it 'Gimei::Name::First オブジェクトが返ること' do
85
- Gimei.first.must_be_instance_of Gimei::Name::First
100
+ _(Gimei.first).must_be_instance_of Gimei::Name::First
86
101
  end
87
102
  end
88
103
 
89
104
  describe '#first' do
90
105
  it 'Gimei::Name::First オブジェクトが返ること' do
91
- Gimei.new.first.must_be_instance_of Gimei::Name::First
106
+ _(Gimei.new.first).must_be_instance_of Gimei::Name::First
92
107
  end
93
108
  end
94
109
 
95
110
  describe '.last' do
96
111
  it 'Gimei::Name::First オブジェクトが返ること' do
97
- Gimei.last.must_be_instance_of Gimei::Name::Last
112
+ _(Gimei.last).must_be_instance_of Gimei::Name::Last
98
113
  end
99
114
  end
100
115
 
101
116
  describe '#last' do
102
117
  it 'Gimei::Name::First オブジェクトが返ること' do
103
- Gimei.new.last.must_be_instance_of Gimei::Name::Last
118
+ _(Gimei.new.last).must_be_instance_of Gimei::Name::Last
104
119
  end
105
120
  end
106
121
 
107
122
  describe '.romaji' do
108
123
  it 'ローマ字とスペースが返ること' do
109
- Gimei.romaji.must_match(/\A[a-zA-Z\s]+\z/)
124
+ _(Gimei.romaji).must_match(/\A[a-zA-Z\s]+\z/)
110
125
  end
111
126
  end
112
127
 
113
128
  describe '#romaji' do
114
129
  it 'ローマ字とスペースが返ること' do
115
- Gimei.new.romaji.must_match(/\A[a-zA-Z\s]+\z/)
130
+ _(Gimei.new.romaji).must_match(/\A[a-zA-Z\s]+\z/)
116
131
  end
117
132
  end
118
133
 
119
134
  describe '.address' do
120
135
  it 'Gimei::Address オブジェクトが返ること' do
121
- Gimei.address.must_be_instance_of Gimei::Address
136
+ _(Gimei.address).must_be_instance_of Gimei::Address
122
137
  end
123
138
  end
124
139
 
125
140
  describe '#address' do
126
141
  it 'Gimei::Address オブジェクトが返ること' do
127
- Gimei.new.address.must_be_instance_of Gimei::Address
142
+ _(Gimei.new.address).must_be_instance_of Gimei::Address
128
143
  end
129
144
  end
130
145
 
131
146
  describe '.prefecture' do
132
147
  it 'Gimei::Address::Prefecture オブジェクトが返ること' do
133
- Gimei.prefecture.must_be_instance_of Gimei::Address::Prefecture
148
+ _(Gimei.prefecture).must_be_instance_of Gimei::Address::Prefecture
134
149
  end
135
150
  end
136
151
 
137
152
  describe '#prefecture' do
138
153
  it 'Gimei::Address::Prefecture オブジェクトが返ること' do
139
- Gimei.new.prefecture.must_be_instance_of Gimei::Address::Prefecture
154
+ _(Gimei.new.prefecture).must_be_instance_of Gimei::Address::Prefecture
140
155
  end
141
156
  end
142
157
 
143
158
  describe '.city' do
144
159
  it 'Gimei::Address::City オブジェクトが返ること' do
145
- Gimei.city.must_be_instance_of Gimei::Address::City
160
+ _(Gimei.city).must_be_instance_of Gimei::Address::City
146
161
  end
147
162
  end
148
163
 
149
164
  describe '#city' do
150
165
  it 'Gimei::Address::City オブジェクトが返ること' do
151
- Gimei.new.city.must_be_instance_of Gimei::Address::City
166
+ _(Gimei.new.city).must_be_instance_of Gimei::Address::City
152
167
  end
153
168
  end
154
169
 
155
170
  describe '.town' do
156
171
  it 'Gimei::Address::Town オブジェクトが返ること' do
157
- Gimei.town.must_be_instance_of Gimei::Address::Town
172
+ _(Gimei.town).must_be_instance_of Gimei::Address::Town
158
173
  end
159
174
  end
160
175
 
161
176
  describe '#town' do
162
177
  it 'Gimei::Address::Town オブジェクトが返ること' do
163
- Gimei.new.town.must_be_instance_of Gimei::Address::Town
178
+ _(Gimei.new.town).must_be_instance_of Gimei::Address::Town
164
179
  end
165
180
  end
166
181
  end
@@ -6,11 +6,15 @@ describe Gimei::Name do
6
6
  before { @name = Gimei::Name.male }
7
7
 
8
8
  it 'Gimei::Name オブジェクトが返ること' do
9
- @name.must_be_instance_of Gimei::Name
9
+ _(@name).must_be_instance_of Gimei::Name
10
+ end
11
+
12
+ it '#gender が :male を返すこと' do
13
+ _(@name.gender).must_equal :male
10
14
  end
11
15
 
12
16
  it '#male? が true を返すこと' do
13
- @name.male?.must_equal true
17
+ _(@name.male?).must_equal true
14
18
  end
15
19
  end
16
20
 
@@ -18,71 +22,82 @@ describe Gimei::Name do
18
22
  before { @name = Gimei::Name.female }
19
23
 
20
24
  it 'Gimei::Name オブジェクトが返ること' do
21
- @name.must_be_instance_of Gimei::Name
25
+ _(@name).must_be_instance_of Gimei::Name
26
+ end
27
+
28
+ it '#gender が :female を返すこと' do
29
+ _(@name.gender).must_equal :female
22
30
  end
23
31
 
24
32
  it '#female? が true を返すこと' do
25
- @name.female?.must_equal true
33
+ _(@name.female?).must_equal true
26
34
  end
27
35
  end
28
36
 
29
37
  describe '.kanji' do
30
38
  it '全角文字とスペースが返ること' do
31
- Gimei::Name.kanji.must_match(/\A[#{Moji.zen}\s]+\z/)
39
+ _(Gimei::Name.kanji).must_match(/\A[#{Moji.zen}\s]+\z/)
32
40
  end
33
41
  end
34
42
 
35
43
  describe '.hiragana' do
36
44
  it 'ひらがなとスペースが返ること' do
37
- Gimei::Name.hiragana.must_match(/\A[\p{hiragana}\s]+\z/)
45
+ _(Gimei::Name.hiragana).must_match(/\A[\p{hiragana}\s]+\z/)
38
46
  end
39
47
  end
40
48
 
41
49
  describe '.katakana' do
42
50
  it 'カタカナとスペースが返ること' do
43
- Gimei::Name.katakana.must_match(/\A[\p{katakana}\s]+\z/)
51
+ _(Gimei::Name.katakana).must_match(/\A[\p{katakana}\s]+\z/)
44
52
  end
45
53
  end
46
54
 
47
55
  describe '.romaji' do
48
56
  it 'ローマ字とスペースが返ること' do
49
- Gimei::Name.romaji.must_match(/\A[a-zA-Z\s]+\z/)
57
+ _(Gimei::Name.romaji).must_match(/\A[a-zA-Z\s]+\z/)
58
+ end
59
+ end
60
+
61
+ describe '#gender' do
62
+ it ':male または :female が返ること' do
63
+ _(Gimei::Name.new.gender).must_be_instance_of(Symbol)
64
+ _(Gimei::Name.new.gender.to_s).must_match(/\A(?:male|female)\Z/)
50
65
  end
51
66
  end
52
67
 
53
68
  describe '#kanji' do
54
69
  it '全角文字とスペースが返ること' do
55
- Gimei::Name.new.kanji.must_match(/\A[#{Moji.zen}\s]+\z/)
70
+ _(Gimei::Name.new.kanji).must_match(/\A[#{Moji.zen}\s]+\z/)
56
71
  end
57
72
  end
58
73
 
59
74
  describe '#hiragana' do
60
75
  it 'ひらがなとスペースが返ること' do
61
- Gimei::Name.new.hiragana.must_match(/\A[\p{hiragana}\s]+\z/)
76
+ _(Gimei::Name.new.hiragana).must_match(/\A[\p{hiragana}\s]+\z/)
62
77
  end
63
78
  end
64
79
 
65
80
  describe '#katakana' do
66
81
  it 'カタカナとスペースが返ること' do
67
- Gimei::Name.new.katakana.must_match(/\A[\p{katakana}\s]+\z/)
82
+ _(Gimei::Name.new.katakana).must_match(/\A[\p{katakana}\s]+\z/)
68
83
  end
69
84
  end
70
85
 
71
86
  describe '#first' do
72
87
  it 'Gimei::Name::First オブジェクトが返ること' do
73
- Gimei::Name.new.first.must_be_instance_of Gimei::Name::First
88
+ _(Gimei::Name.new.first).must_be_instance_of Gimei::Name::First
74
89
  end
75
90
  end
76
91
 
77
92
  describe '#last' do
78
93
  it 'Gimei::Name::Last オブジェクトが返ること' do
79
- Gimei::Name.new.last.must_be_instance_of Gimei::Name::Last
94
+ _(Gimei::Name.new.last).must_be_instance_of Gimei::Name::Last
80
95
  end
81
96
  end
82
97
 
83
98
  describe '.romaji' do
84
99
  it 'ローマ字とスペースが返ること' do
85
- Gimei::Name.new.romaji.must_match(/\A[a-zA-Z\s]+\z/)
100
+ _(Gimei::Name.new.romaji).must_match(/\A[a-zA-Z\s]+\z/)
86
101
  end
87
102
  end
88
103
  end
@@ -92,11 +107,11 @@ describe Gimei::Name::First do
92
107
  before { @name = Gimei::Name::First.male }
93
108
 
94
109
  it 'Gimei::Name::First オブジェクトが返ること' do
95
- @name.must_be_instance_of Gimei::Name::First
110
+ _(@name).must_be_instance_of Gimei::Name::First
96
111
  end
97
112
 
98
113
  it '#male? が true を返すこと' do
99
- @name.male?.must_equal true
114
+ _(@name.male?).must_equal true
100
115
  end
101
116
  end
102
117
 
@@ -104,41 +119,41 @@ describe Gimei::Name::First do
104
119
  before { @name = Gimei::Name::First.female }
105
120
 
106
121
  it 'Gimei::Name::First オブジェクトが返ること' do
107
- @name.must_be_instance_of Gimei::Name::First
122
+ _(@name).must_be_instance_of Gimei::Name::First
108
123
  end
109
124
 
110
125
  it '#female? が true を返すこと' do
111
- @name.female?.must_equal true
126
+ _(@name.female?).must_equal true
112
127
  end
113
128
  end
114
129
 
115
130
  describe '#kanji' do
116
131
  it '全角文字が返ること' do
117
- Gimei::Name::First.new.kanji.must_match(/\A#{Moji.zen}+\z/)
132
+ _(Gimei::Name::First.new.kanji).must_match(/\A#{Moji.zen}+\z/)
118
133
  end
119
134
  end
120
135
 
121
136
  describe '#hiragana' do
122
137
  it 'ひらがなが返ること' do
123
- Gimei::Name::First.new.hiragana.must_match(/\A\p{hiragana}+\z/)
138
+ _(Gimei::Name::First.new.hiragana).must_match(/\A\p{hiragana}+\z/)
124
139
  end
125
140
  end
126
141
 
127
142
  describe '#katakana' do
128
143
  it 'カタカナが返ること' do
129
- Gimei::Name::First.new.katakana.must_match(/\A\p{katakana}+\z/)
144
+ _(Gimei::Name::First.new.katakana).must_match(/\A\p{katakana}+\z/)
130
145
  end
131
146
  end
132
147
 
133
148
  describe '#to_s' do
134
149
  it '全角文字が返ること' do
135
- Gimei::Name::First.new.to_s.must_match(/\A#{Moji.zen}+\z/)
150
+ _(Gimei::Name::First.new.to_s).must_match(/\A#{Moji.zen}+\z/)
136
151
  end
137
152
  end
138
153
 
139
154
  describe '#romaji' do
140
155
  it 'アルファベットで返ること' do
141
- Gimei::Name::First.new.romaji.must_match(/\A[a-zA-Z]+\z/)
156
+ _(Gimei::Name::First.new.romaji).must_match(/\A[a-zA-Z]+\z/)
142
157
  end
143
158
  end
144
159
  end
@@ -148,31 +163,31 @@ describe Gimei::Name::Last do
148
163
 
149
164
  describe '#kanji' do
150
165
  it '全角文字が返ること' do
151
- @name.kanji.must_match(/\A#{Moji.zen}+\z/)
166
+ _(@name.kanji).must_match(/\A#{Moji.zen}+\z/)
152
167
  end
153
168
  end
154
169
 
155
170
  describe '#hiragana' do
156
171
  it 'ひらがなが返ること' do
157
- @name.hiragana.must_match(/\A\p{hiragana}+\z/)
172
+ _(@name.hiragana).must_match(/\A\p{hiragana}+\z/)
158
173
  end
159
174
  end
160
175
 
161
176
  describe '#katakana' do
162
177
  it 'カタカナが返ること' do
163
- @name.katakana.must_match(/\A\p{katakana}+\z/)
178
+ _(@name.katakana).must_match(/\A\p{katakana}+\z/)
164
179
  end
165
180
  end
166
181
 
167
182
  describe '#to_s' do
168
183
  it '全角文字が返ること' do
169
- @name.to_s.must_match(/\A#{Moji.zen}+\z/)
184
+ _(@name.to_s).must_match(/\A#{Moji.zen}+\z/)
170
185
  end
171
186
  end
172
187
 
173
188
  describe '#romaji' do
174
189
  it 'アルファベットで返ること' do
175
- Gimei::Name::First.new.romaji.must_match(/\A[a-z|A-Z]+\z/)
190
+ _(Gimei::Name::First.new.romaji).must_match(/\A[a-z|A-Z]+\z/)
176
191
  end
177
192
  end
178
193
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gimei
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - willnet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-28 00:00:00.000000000 Z
11
+ date: 2019-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: romaji
@@ -126,8 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
126
126
  - !ruby/object:Gem::Version
127
127
  version: '0'
128
128
  requirements: []
129
- rubyforge_project:
130
- rubygems_version: 2.6.13
129
+ rubygems_version: 3.1.2
131
130
  signing_key:
132
131
  specification_version: 4
133
132
  summary: random Japanese name and address generator. support kanji, hiragana, and