rubimas 0.5.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +9 -1
  3. data/README.md +38 -14
  4. data/config/idols/01_haruka.yml +13 -10
  5. data/config/idols/02_chihaya.yml +12 -9
  6. data/config/idols/03_miki.yml +14 -11
  7. data/config/idols/04_yukiho.yml +11 -8
  8. data/config/idols/05_yayoi.yml +14 -11
  9. data/config/idols/06_makoto.yml +14 -11
  10. data/config/idols/07_iori.yml +13 -10
  11. data/config/idols/08_takane.yml +13 -10
  12. data/config/idols/09_ritsuko.yml +13 -10
  13. data/config/idols/10_azusa.yml +12 -9
  14. data/config/idols/11_ami.yml +13 -10
  15. data/config/idols/12_mami.yml +13 -10
  16. data/config/idols/13_hibiki.yml +14 -11
  17. data/config/idols/14_mirai.yml +12 -9
  18. data/config/idols/15_shizuka.yml +13 -10
  19. data/config/idols/16_tsubasa.yml +12 -9
  20. data/config/idols/17_kotoha.yml +12 -9
  21. data/config/idols/18_erena.yml +12 -9
  22. data/config/idols/19_minako.yml +12 -9
  23. data/config/idols/20_megumi.yml +12 -9
  24. data/config/idols/21_matsuri.yml +13 -10
  25. data/config/idols/22_serika.yml +13 -10
  26. data/config/idols/23_akane.yml +12 -9
  27. data/config/idols/24_anna.yml +12 -9
  28. data/config/idols/25_roko.yml +13 -10
  29. data/config/idols/26_yuriko.yml +12 -9
  30. data/config/idols/27_sayoko.yml +13 -10
  31. data/config/idols/28_arisa.yml +12 -9
  32. data/config/idols/29_umi.yml +13 -10
  33. data/config/idols/30_iku.yml +12 -9
  34. data/config/idols/31_tomoka.yml +12 -9
  35. data/config/idols/32_emily.yml +13 -10
  36. data/config/idols/33_shiho.yml +13 -10
  37. data/config/idols/34_ayumu.yml +12 -9
  38. data/config/idols/35_hinata.yml +12 -9
  39. data/config/idols/36_kana.yml +13 -10
  40. data/config/idols/37_nao.yml +12 -9
  41. data/config/idols/38_chiduru.yml +12 -9
  42. data/config/idols/39_konomi.yml +12 -9
  43. data/config/idols/40_tamaki.yml +12 -9
  44. data/config/idols/41_fuuka.yml +13 -10
  45. data/config/idols/42_miya.yml +13 -10
  46. data/config/idols/43_noriko.yml +12 -9
  47. data/config/idols/44_mizuki.yml +12 -9
  48. data/config/idols/45_karen.yml +13 -10
  49. data/config/idols/46_rio.yml +12 -9
  50. data/config/idols/47_subaru.yml +13 -10
  51. data/config/idols/48_reika.yml +12 -9
  52. data/config/idols/49_momoko.yml +12 -9
  53. data/config/idols/50_juria.yml +10 -7
  54. data/config/idols/51_tsumugi.yml +31 -0
  55. data/config/idols/52_kaori.yml +31 -0
  56. data/lib/rubimas.rb +4 -0
  57. data/lib/rubimas/idol.rb +14 -4
  58. data/lib/rubimas/version.rb +1 -1
  59. data/spec/spec_helper.rb +4 -0
  60. data/spec/units/rubimas/idol_spec.rb +46 -0
  61. metadata +4 -4
  62. data/bin/touch_idol_files.rb +0 -5
@@ -1,12 +1,13 @@
1
+ ---
1
2
  reika:
2
3
  idol_id: 48
3
- idol_type: Da
4
+ idol_type: Angel
4
5
  name:
5
- family: "北上"
6
- family_kana: "きたかみ"
7
- given: "麗花"
8
- given_kana: "れいか"
9
- shorten: "麗花"
6
+ family: 北上
7
+ family_kana: きたかみ
8
+ given: 麗花
9
+ given_kana: れいか
10
+ shorten: 麗花
10
11
  age: 20
11
12
  height: 164.0
12
13
  weight: 47.0
@@ -17,10 +18,12 @@ reika:
17
18
  blood_type: A
18
19
  handedness: right
19
20
  hobbies:
20
- - "登山"
21
+ - 登山
21
22
  talents:
22
- - "肺活量が大きい"
23
+ - 肺活量が大きい
23
24
  favorites:
24
- - "ドライブ"
25
+ - ドライブ
25
26
  color: "#6bb6b0"
26
27
  cv: 平山笑美
28
+ birthplace: 長野県
29
+ idol_image: Dance
@@ -1,12 +1,13 @@
1
+ ---
1
2
  momoko:
2
3
  idol_id: 49
3
- idol_type: Vi
4
+ idol_type: Fairy
4
5
  name:
5
- family: "周防"
6
- family_kana: "すおう"
7
- given: "桃子"
8
- given_kana: "ももこ"
9
- shorten: "桃子"
6
+ family: 周防
7
+ family_kana: すおう
8
+ given: 桃子
9
+ given_kana: ももこ
10
+ shorten: 桃子
10
11
  age: 11
11
12
  height: 140.0
12
13
  weight: 35.0
@@ -17,10 +18,12 @@ momoko:
17
18
  blood_type: B
18
19
  handedness: right
19
20
  hobbies:
20
- - "かわいいシール集め"
21
+ - かわいいシール集め
21
22
  talents:
22
- - "演技や台詞の暗記"
23
+ - 演技や台詞の暗記
23
24
  favorites:
24
- - "ホットケーキ"
25
+ - ホットケーキ
25
26
  color: "#efb864"
26
27
  cv: 渡部恵子
28
+ birthplace: 東京都
29
+ idol_image: Visual
@@ -1,22 +1,25 @@
1
+ ---
1
2
  juria:
2
3
  idol_id: 50
3
- idol_type: Vo
4
+ idol_type: Fairy
4
5
  name:
5
- aka: "ジュリア"
6
- shorten: "ジュリア"
6
+ aka: ジュリア
7
+ shorten: ジュリア
7
8
  age: 16
8
9
  height: 157.0
9
10
  weight: 43.0
10
11
  bust: 79.0
11
12
  waist: 54.0
12
13
  hip: 80.0
13
- birthday: 09/26
14
+ birthday: '09/26'
14
15
  blood_type: O
15
16
  handedness: left
16
- hobbies:
17
+ hobbies:
17
18
  talents:
18
- - "ギター"
19
+ - ギター
19
20
  favorites:
20
- - "パンクロック"
21
+ - パンクロック
21
22
  color: "#d7385f"
22
23
  cv: 愛美
24
+ birthplace: 福岡県
25
+ idol_image: Vocal
@@ -0,0 +1,31 @@
1
+ ---
2
+ tsumugi:
3
+ idol_id: 51
4
+ idol_type: Fairy
5
+ name:
6
+ family: 白石
7
+ family_kana: しらいし
8
+ given: 紬
9
+ given_kana: つむぎ
10
+ shorten: 紬
11
+ age: 17
12
+ height: 160.0
13
+ weight: 45.0
14
+ bust: 82.0
15
+ waist: 56.0
16
+ hip: 83.0
17
+ birthday: 05/29
18
+ blood_type: AB
19
+ handedness: right
20
+ hobbies:
21
+ - 庭園
22
+ - 甘味処巡り
23
+ talents:
24
+ - 着物の着付け
25
+ - 三味線
26
+ favorites:
27
+ - 和スイーツ
28
+ color: "#e6dcf7"
29
+ cv: 南早紀
30
+ birthplace: 石川県
31
+ idol_image:
@@ -0,0 +1,31 @@
1
+ ---
2
+ kaori:
3
+ idol_id: 52
4
+ idol_type: Angel
5
+ name:
6
+ family: 桜守
7
+ family_kana: さくらもり
8
+ given: 歌織
9
+ given_kana: かおり
10
+ shorten: 歌織
11
+ age: 23
12
+ height: 165.0
13
+ weight: 47.0
14
+ bust: 88.0
15
+ waist: 58.0
16
+ hip: 85.0
17
+ birthday: 03/27
18
+ blood_type: O
19
+ handedness: right
20
+ hobbies:
21
+ - 乗馬
22
+ talents:
23
+ - 合唱
24
+ - ゴルフ
25
+ favorites:
26
+ - 子ども
27
+ - 洋菓子
28
+ color: "#28417d"
29
+ cv: 香里有佐
30
+ birthplace: 東京都
31
+ idol_image:
@@ -8,6 +8,10 @@ require "rubimas/unit"
8
8
  require "rubimas/core_ext/integer"
9
9
 
10
10
  module Rubimas
11
+ def self.theaterdays!
12
+ Rubimas::Idol.theaterdays!
13
+ end
14
+
11
15
  def self.method_missing(name, *args)
12
16
  if Rubimas::Idol.valid?(name)
13
17
  Rubimas::Idol.find_by_name(name)
@@ -1,14 +1,16 @@
1
1
  module Rubimas
2
2
  class Idol
3
- attr_reader :idol_id, :key, :idol_type, :name, :age, :height, :weight, :bust, :waist, :hip,
3
+ attr_reader :idol_id, :key, :idol_type, :idol_image, :name, :age, :height, :weight, :bust, :waist, :hip,
4
4
  :birthday, :blood_type, :handedness, :hobbies, :talents, :favorites, :color, :cv
5
5
  @@config = nil
6
6
  @@all_idols = nil
7
+ @@theaterdays = false
7
8
 
8
9
  def initialize(**args)
9
10
  @idol_id = args[:idol_id]
10
11
  @key = args[:key]
11
12
  @idol_type = args[:idol_type]
13
+ @idol_image = args[:idol_image]
12
14
  @name = Name.new(args[:name])
13
15
  @age = args[:age]
14
16
  @height = args[:height]
@@ -28,15 +30,23 @@ module Rubimas
28
30
  alias_method :id, :idol_id
29
31
 
30
32
  class << self
31
- def config
32
- unless @@config
33
- @@config = Dir.glob("#{File.dirname(__FILE__)}/../../config/idols/*.yml").each_with_object({}) do |file, idols|
33
+ def config(force: false)
34
+ unless @@config && !force
35
+ regexp = @@theaterdays ? '*' : '{[0-4][0-9],50}*'
36
+ @@config = Dir.glob("#{File.dirname(__FILE__)}/../../config/idols/#{regexp}.yml").each_with_object({}) do |file, idols|
34
37
  idols.merge!(YAML.load_file(file))
35
38
  end.deep_symbolize_keys
39
+ @@all_idols = nil
36
40
  end
37
41
  @@config
38
42
  end
39
43
 
44
+ def theaterdays!
45
+ @@theaterdays = true
46
+ config(force: true)
47
+ true
48
+ end
49
+
40
50
  def names
41
51
  config.keys
42
52
  end
@@ -1,3 +1,3 @@
1
1
  module Rubimas
2
- VERSION = "0.5.0"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -3,3 +3,7 @@ require 'rubimas'
3
3
  require 'rspec'
4
4
  require 'rspec-parameterized'
5
5
  require 'rspec/its'
6
+
7
+ RSpec.configure do |config|
8
+ config.order = 'random'
9
+ end
@@ -7,6 +7,38 @@ describe Rubimas::Idol do
7
7
  specify 'All idol count is 50' do
8
8
  expect(subject.keys.count).to eq 50
9
9
  end
10
+
11
+ context 'when calling `theaterdays!` before config.' do
12
+ before { described_class.theaterdays! }
13
+
14
+ specify 'All idol count is 52' do
15
+ expect(subject.keys.count).to eq 52
16
+ end
17
+
18
+ after do
19
+ Rubimas::Idol.class_variable_set(:@@theaterdays, false)
20
+ Rubimas::Idol.config(force: true)
21
+ end
22
+ end
23
+ end
24
+
25
+ describe '#theaterdays!' do
26
+ it "should change idol's count" do
27
+ expect { Rubimas.find_by_name('紬') }.to raise_error Rubimas::Idol::UnknownIdolError
28
+ expect { Rubimas.find_by_name('歌織') }.to raise_error Rubimas::Idol::UnknownIdolError
29
+ expect(described_class.all.count).to eq 50
30
+
31
+ Rubimas.theaterdays!
32
+
33
+ expect { Rubimas.find_by_name('紬') }.not_to raise_error
34
+ expect { Rubimas.find_by_name('歌織') }.not_to raise_error
35
+ expect(described_class.all.count).to eq 52
36
+ end
37
+
38
+ after do
39
+ Rubimas::Idol.class_variable_set(:@@theaterdays, false)
40
+ Rubimas::Idol.config(force: true)
41
+ end
10
42
  end
11
43
 
12
44
  describe '#all' do
@@ -16,6 +48,20 @@ describe Rubimas::Idol do
16
48
  expect(subject.first.key).to eq :haruka
17
49
  expect(subject.last.key).to eq :juria
18
50
  end
51
+
52
+ context 'when calling `theaterdays!` before config.' do
53
+ before { described_class.theaterdays! }
54
+
55
+ specify 'Idols are order by id' do
56
+ expect(subject.first.key).to eq :haruka
57
+ expect(subject.last.key).to eq :kaori
58
+ end
59
+
60
+ after do
61
+ Rubimas::Idol.class_variable_set(:@@theaterdays, false)
62
+ Rubimas::Idol.config(force: true)
63
+ end
64
+ end
19
65
  end
20
66
 
21
67
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubimas
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - treby
@@ -140,8 +140,7 @@ description: The 765 pro idol's information library. This gem provides names, bi
140
140
  favorites, etc.
141
141
  email:
142
142
  - me@treby.info
143
- executables:
144
- - touch_idol_files.rb
143
+ executables: []
145
144
  extensions: []
146
145
  extra_rdoc_files: []
147
146
  files:
@@ -154,7 +153,6 @@ files:
154
153
  - LICENSE.txt
155
154
  - README.md
156
155
  - Rakefile
157
- - bin/touch_idol_files.rb
158
156
  - config/idols/01_haruka.yml
159
157
  - config/idols/02_chihaya.yml
160
158
  - config/idols/03_miki.yml
@@ -205,6 +203,8 @@ files:
205
203
  - config/idols/48_reika.yml
206
204
  - config/idols/49_momoko.yml
207
205
  - config/idols/50_juria.yml
206
+ - config/idols/51_tsumugi.yml
207
+ - config/idols/52_kaori.yml
208
208
  - config/units/brand_new_stage/aquarius.yml
209
209
  - config/units/brand_new_stage/aries.yml
210
210
  - config/units/brand_new_stage/cancer.yml
@@ -1,5 +0,0 @@
1
- require 'rubimas'
2
-
3
- (1..50).each do |num|
4
- FileUtils.touch(File.dirname(__FILE__) + ("/config/idols/%02d_%s.yml" % [num, Rubimas.find(num).key]))
5
- end