rubicure 0.0.3 → 0.0.4

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: e71b8a8d5de2e5f6a95ddacf68d3eac30f031d31
4
- data.tar.gz: 9f3251bbcd7124a8d82b462ac603f09eef04e60a
3
+ metadata.gz: a7ce6948fbd7c3fa80aaf39c61f5b1ab8ce98fbe
4
+ data.tar.gz: a3eb296887ba93f63f35fbdab08ea5f60b19aebd
5
5
  SHA512:
6
- metadata.gz: c0b8fd44da9ed44e5c88f2b4159422c9cfffce6b48b0053a4a36459e2b98ccb98c63bbfbe776197f44441672a7c26eb61c8a86bc4f9e3803371e4a66597d0903
7
- data.tar.gz: fa325ecb30e69086502298dabf8a8b371ef56441ded85d07d08ba2b6187f59f5b370277f2f62b7ff2cc168448d1062aff4cce57b9004e06d86803beebd5b8a28
6
+ metadata.gz: fd439d2bfa4f82f83fb8bd223c4baa084914a5802525106256a6de2e86955ef6619ef8b2334137c036353f3ae10e146211b5c553bccdf49fd19414b80de9da48
7
+ data.tar.gz: 8036dc70d3f46041dddd1beede49b7f77c531a589ca1732ae154f1612f9adc8eb7248a534e53fdbf961473be123ea07b0fc9cb92765279642887c128a379e2c1
data/.travis.yml CHANGED
@@ -1,6 +1,9 @@
1
1
  language: ruby
2
2
  rvm:
3
3
  - 2.0.0
4
+ - 2.1.0
5
+ before_install:
6
+ - gem install bundler -v '= 1.5.1'
4
7
  script: CODECLIMATE_REPO_TOKEN=ae44e61ae42dc9114b3cd92bed8dc553d9e9f119634c8b95273d3048e6026aa5 bundle exec rspec --tag category:verbose && bundle exec rspec
5
8
  branches:
6
9
  only:
data/CHANGELOG.md CHANGED
@@ -1,10 +1,22 @@
1
1
  ## master
2
- [full changelog](http://github.com/sue445/rubicure/compare/v0.0.3...master)
2
+ [full changelog](http://github.com/sue445/rubicure/compare/v0.0.4...master)
3
+
4
+ ## v0.0.4
5
+ [full changelog](http://github.com/sue445/rubicure/compare/v0.0.3...v0.0.4)
6
+
7
+ ### Enhancements
8
+ * Add cure heart engage mode :sparkling_heart:
9
+ * Add cure bright and cure windy (thx @kaosf)
10
+ * https://github.com/sue445/rubicure/pull/15
11
+ * Impl `Precure#each_with_series` (alias to `Precure#each`)
12
+ * https://github.com/sue445/rubicure/pull/13
13
+ * Add arg to `Precure#all_stars`
14
+ * https://github.com/sue445/rubicure/pull/16
3
15
 
4
16
  ## v0.0.3
5
17
  [full changelog](http://github.com/sue445/rubicure/compare/v0.0.2...v0.0.3)
6
18
 
7
- # Enhancements
19
+ ### Enhancements
8
20
  * define operators(`Girl#==`, `Series#===`) (thx @zonuexe)
9
21
  * https://github.com/sue445/rubicure/pull/7
10
22
  * Remove last linebreaks of transform_messages (thx @zonuexe)
data/README.md CHANGED
@@ -81,6 +81,25 @@ Precure.find(:smile).title
81
81
 
82
82
  and [more aliases!](config/series.yml)
83
83
 
84
+ ### each with precure series
85
+ ```ruby
86
+ Precure.each{|series| puts series.title }
87
+ ふたりはプリキュア
88
+ ふたりはプリキュア Max Heart
89
+ ふたりはプリキュア Splash Star
90
+ Yes! プリキュア5
91
+ Yes! プリキュア5 Go Go!
92
+ フレッシュプリキュア!
93
+ ハートキャッチプリキュア!
94
+ スイートプリキュア♪
95
+ スマイルプリキュア!
96
+ ドキドキ!プリキュア
97
+ #=> [:unmarked, :max_heart, :splash_star, :yes, :yes_gogo, :fresh, :heart_catch, :suite, :smile, :dokidoki]
98
+
99
+ Precure.inject([]){|girl_count_of_series, series| girl_count_of_series << series.girls.count; girl_count_of_series }
100
+ #=> [2, 3, 2, 5, 6, 4, 4, 4, 5, 5]
101
+ ```
102
+
84
103
  ### Get current precure series
85
104
  `Precure#now` (alias to `#current` ) return current precure series
86
105
 
@@ -203,8 +222,24 @@ Precure.all_stars.count
203
222
 
204
223
  Precure.all_stars.map(&:precure_name)
205
224
  #=> ["キュアブラック", "キュアホワイト", "シャイニールミナス", "キュアブルーム", "キュアイーグレット", "キュアドリーム", "キュアルージュ", "キュアレモネード", "キュアミント", "キュアアクア", "ミルキィローズ", "キュアピーチ", "キュアベリー", "キュアパイン", "キュアパッション", "キュアブロッサム", "キュアマリン", "キュアサンシャイン", "キュアムーンライト", "キュアメロディ", "キュアリズム", "キュアビート", "キュアミューズ", "キュアハッピー", "キュアサニー", "キュアピース", "キュアマーチ", "キュアビューティ", "キュアハート", "キュアダイヤモンド", "キュアロゼッタ", "キュアソード", "キュアエース"]
225
+
226
+ Precure.all_stars("2013-10-26").count
227
+ #=> 33
228
+ Precure.all_stars(:dx).count
229
+ #=> 14
230
+ Precure.all_stars(:dx2).count
231
+ #=> 17
232
+ Precure.all_stars(:dx3).count
233
+ #=> 21
234
+ Precure.all_stars(:new_stage).count
235
+ #=> 28
236
+ Precure.all_stars(:new_stage2).count
237
+ #=> 32
206
238
  ```
207
239
 
240
+ and [more aliases!](config/movies.yml)
241
+
242
+
208
243
  ### Equivalence
209
244
  ```ruby
210
245
  yayoi = Cure.peace.dup
data/config/girls.yml CHANGED
@@ -2,6 +2,7 @@
2
2
  cure_black: &cure_black
3
3
  human_name: 美墨なぎさ
4
4
  precure_name: キュアブラック
5
+ created_date: 2004-02-01 # episode 1
5
6
  transform_message: |-
6
7
  デュアル・オーロラ・ウェイブ!!
7
8
  光の使者、キュアブラック!
@@ -12,6 +13,7 @@ cure_black: &cure_black
12
13
  cure_white: &cure_white
13
14
  human_name: 雪城ほのか
14
15
  precure_name: キュアホワイト
16
+ created_date: 2004-02-01 # episode 1
15
17
  transform_message: |-
16
18
  デュアル・オーロラ・ウェイブ!!
17
19
  光の使者、キュアホワイト!
@@ -28,6 +30,7 @@ white:
28
30
  shiny_luminous: &shiny_luminous
29
31
  human_name: 九条ひかり
30
32
  precure_name: シャイニールミナス
33
+ created_date: 2005-03-06 # episode 5
31
34
  transform_message: |-
32
35
  ルミナス・シャイニングストリーム!
33
36
  輝く命、シャイニールミナス!
@@ -40,6 +43,7 @@ luminous:
40
43
  cure_bloom: &cure_bloom
41
44
  human_name: 日向咲
42
45
  precure_name: キュアブルーム
46
+ created_date: 2006-02-05 # episode 1
43
47
  transform_message: |-
44
48
  デュアル・スピリチュアル・パワー!
45
49
  花開け大地に!
@@ -47,11 +51,10 @@ cure_bloom: &cure_bloom
47
51
  ふたりはプリキュア!
48
52
  聖なる泉を汚す者よ!
49
53
  阿漕な真似はお止めなさい!
50
- extra_names:
51
- - キュアブライト
52
54
  cure_egret: &cure_egret
53
55
  human_name: 美翔舞
54
56
  precure_name: キュアイーグレット
57
+ created_date: 2006-02-05 # episode 1
55
58
  transform_message: |-
56
59
  デュアル・スピリチュアル・パワー!
57
60
  羽ばたけ空に!
@@ -59,17 +62,42 @@ cure_egret: &cure_egret
59
62
  ふたりはプリキュア!
60
63
  聖なる泉を汚す者よ!
61
64
  阿漕な真似はお止めなさい!
62
- extra_names:
63
- - キュアウィンディ
65
+ cure_bright: &cure_bright
66
+ human_name: 日向咲
67
+ precure_name: キュアブライト
68
+ created_date: 2006-09-03 # episode 30
69
+ transform_message: |-
70
+ デュアル・スピリチュアル・パワー!
71
+ 未来を照らし!
72
+ 天空に満ちる月! キュアブライト!
73
+ ふたりはプリキュア!
74
+ 聖なる泉を汚す者よ!
75
+ 阿漕な真似はお止めなさい!
76
+ cure_windy: &cure_windy
77
+ human_name: 美翔舞
78
+ precure_name: キュアウィンディ
79
+ created_date: 2006-09-03 # episode 30
80
+ transform_message: |-
81
+ デュアル・スピリチュアル・パワー!
82
+ 勇気を運べ!
83
+ 大地に薫る月! キュアウィンディ!
84
+ ふたりはプリキュア!
85
+ 聖なる泉を汚す者よ!
86
+ 阿漕な真似はお止めなさい!
64
87
  bloom:
65
88
  <<: *cure_bloom
66
89
  egret:
67
90
  <<: *cure_egret
91
+ bright:
92
+ <<: *cure_bright
93
+ windy:
94
+ <<: *cure_windy
68
95
 
69
96
  # yes
70
97
  cure_dream: &cure_dream
71
98
  human_name: 夢原のぞみ
72
99
  precure_name: キュアドリーム
100
+ created_date: 2007-02-04 # episode 1
73
101
  transform_message: |-
74
102
  プリキュア!メタモルフォーゼ!
75
103
  大いなる希望の力、キュアドリーム!
@@ -80,6 +108,7 @@ cure_dream: &cure_dream
80
108
  cure_rouge: &cure_rouge
81
109
  human_name: 夏木りん
82
110
  precure_name: キュアルージュ
111
+ created_date: 2007-02-11 # episode 2
83
112
  transform_message: |-
84
113
  プリキュア!メタモルフォーゼ!
85
114
  情熱の赤い炎、キュアルージュ!
@@ -90,6 +119,7 @@ cure_rouge: &cure_rouge
90
119
  cure_lemonade: &cure_lemonade
91
120
  human_name: 春日野うらら
92
121
  precure_name: キュアレモネード
122
+ created_date: 2007-02-18 # episode 3
93
123
  transform_message: |-
94
124
  プリキュア!メタモルフォーゼ!
95
125
  はじけるレモンの香り、キュアレモネード!
@@ -100,6 +130,7 @@ cure_lemonade: &cure_lemonade
100
130
  cure_mint: &cure_mint
101
131
  human_name: 秋元こまち
102
132
  precure_name: キュアミント
133
+ created_date: 2007-02-25 # episode 4
103
134
  transform_message: |-
104
135
  プリキュア!メタモルフォーゼ!
105
136
  安らぎの緑の大地、キュアミント!
@@ -110,6 +141,7 @@ cure_mint: &cure_mint
110
141
  cure_aqua: &cure_aqua
111
142
  human_name: 水無月かれん
112
143
  precure_name: キュアアクア
144
+ created_date: 2007-03-11 # episode 6
113
145
  transform_message: |-
114
146
  プリキュア!メタモルフォーゼ!
115
147
  知性の青き泉、キュアアクア!
@@ -132,6 +164,7 @@ aqua:
132
164
  milky_rose: &milky_rose
133
165
  human_name: 美々野くるみ
134
166
  precure_name: ミルキィローズ
167
+ created_date: 2008-04-06 # episode 10
135
168
  transform_message: |-
136
169
  スカイローズ・トランスレイト!
137
170
  青いバラは秘密のしるし! ミルキィローズ!
@@ -143,6 +176,7 @@ rose:
143
176
  cure_peach: &cure_peach
144
177
  human_name: 桃園ラブ
145
178
  precure_name: キュアピーチ
179
+ created_date: 2009-02-01 # episode 1
146
180
  transform_message: |-
147
181
  チェインジ!プリキュア・ビートアップ!
148
182
  ピンクのハートは愛あるしるし!
@@ -153,6 +187,7 @@ cure_peach: &cure_peach
153
187
  cure_berry: &cure_berry
154
188
  human_name: 蒼乃美希
155
189
  precure_name: キュアベリー
190
+ created_date: 2009-02-08 # episode 2
156
191
  transform_message: |-
157
192
  チェインジ!プリキュア・ビートアップ!
158
193
  ブルーのハートは希望のしるし!
@@ -163,6 +198,7 @@ cure_berry: &cure_berry
163
198
  cure_pine: &cure_pine
164
199
  human_name: 山吹祈里
165
200
  precure_name: キュアパイン
201
+ created_date: 2009-02-15 # episode 3
166
202
  transform_message: |-
167
203
  チェインジ!プリキュア・ビートアップ!
168
204
  イエローハートは祈りのしるし!
@@ -173,6 +209,7 @@ cure_pine: &cure_pine
173
209
  cure_passion: &cure_passion
174
210
  human_name: 東せつな
175
211
  precure_name: キュアパッション
212
+ created_date: 2009-07-12 # episode 23
176
213
  transform_message: |-
177
214
  チェインジ!プリキュア・ビートアップ!
178
215
  真っ赤なハートは幸せの証!
@@ -193,6 +230,7 @@ passion:
193
230
  cure_blossom: &cure_blossom
194
231
  human_name: 花咲つぼみ
195
232
  precure_name: キュアブロッサム
233
+ created_date: 2010-02-07 # episode 1
196
234
  transform_message: |-
197
235
  (プリキュアの種、いくですぅ!)
198
236
  プリキュア!オープンマイハート!
@@ -203,6 +241,7 @@ cure_blossom: &cure_blossom
203
241
  cure_marine: &cure_marine
204
242
  human_name: 来海えりか
205
243
  precure_name: キュアマリン
244
+ created_date: 2010-02-21 # episode 3
206
245
  transform_message: |-
207
246
  (プリキュアの種、いくですぅ!)
208
247
  プリキュア!オープンマイハート!
@@ -213,6 +252,7 @@ cure_marine: &cure_marine
213
252
  cure_sunshine: &cure_sunshine
214
253
  human_name: 明堂院いつき
215
254
  precure_name: キュアサンシャイン
255
+ created_date: 2010-07-18 # episode 23
216
256
  transform_message: |-
217
257
  (プリキュアの種、いくですぅ!)
218
258
  プリキュア!オープンマイハート!
@@ -223,6 +263,7 @@ cure_sunshine: &cure_sunshine
223
263
  cure_moonlight: &cure_moonlight
224
264
  human_name: 月影ゆり
225
265
  precure_name: キュアムーンライト
266
+ created_date: 2010-09-26 # episode 33
226
267
  transform_message: |-
227
268
  (プリキュアの種、いくですぅ!)
228
269
  プリキュア!オープンマイハート!
@@ -243,6 +284,7 @@ moonlight:
243
284
  cure_melody: &cure_melody
244
285
  human_name: 北条響
245
286
  precure_name: キュアメロディ
287
+ created_date: 2011-02-06 # episode 1
246
288
  transform_message: |-
247
289
  レッツプレイ!プリキュアモジュレーション!!
248
290
  爪弾くは荒ぶる調べ! キュアメロディ!
@@ -252,6 +294,7 @@ cure_melody: &cure_melody
252
294
  cure_rhythm: &cure_rhythm
253
295
  human_name: 南野奏
254
296
  precure_name: キュアリズム
297
+ created_date: 2011-02-06 # episode 1
255
298
  transform_message: |-
256
299
  レッツプレイ!プリキュアモジュレーション!!
257
300
  爪弾くはたおやかな調べ! キュアリズム!
@@ -261,6 +304,7 @@ cure_rhythm: &cure_rhythm
261
304
  cure_beat: &cure_beat
262
305
  human_name: 黒川エレン
263
306
  precure_name: キュアビート
307
+ created_date: 2011-07-10 # episode 21
264
308
  transform_message: |-
265
309
  レッツプレイ!プリキュアモジュレーション!!
266
310
  爪弾くは魂の調べ! キュアビート!
@@ -270,6 +314,7 @@ cure_beat: &cure_beat
270
314
  cure_muse: &cure_muse
271
315
  human_name: 調辺アコ
272
316
  precure_name: キュアミューズ
317
+ created_date: 2011-10-16 # episode 35
273
318
  transform_message: |-
274
319
  レッツプレイ!プリキュアモジュレーション!!
275
320
  爪弾くは女神の調べ! キュアミューズ!
@@ -289,6 +334,7 @@ muse:
289
334
  cure_happy: &cure_happy
290
335
  human_name: 星空みゆき
291
336
  precure_name: キュアハッピー
337
+ created_date: 2012-02-05 # episode 1
292
338
  transform_message: |-
293
339
  (レディ?)
294
340
  プリキュア・スマイルチャージ!
@@ -302,6 +348,7 @@ cure_happy: &cure_happy
302
348
  cure_sunny: &cure_sunny
303
349
  human_name: 日野あかね
304
350
  precure_name: キュアサニー
351
+ created_date: 2012-02-12 # episode 2
305
352
  transform_message: |-
306
353
  (レディ?)
307
354
  プリキュア・スマイルチャージ!
@@ -315,6 +362,7 @@ cure_sunny: &cure_sunny
315
362
  cure_peace: &cure_peace
316
363
  human_name: 黄瀬やよい
317
364
  precure_name: キュアピース
365
+ created_date: 2012-02-19 # episode 3
318
366
  transform_message: |-
319
367
  (レディ?)
320
368
  プリキュア・スマイルチャージ!
@@ -328,6 +376,7 @@ cure_peace: &cure_peace
328
376
  cure_march: &cure_march
329
377
  human_name: 緑川なお
330
378
  precure_name: キュアマーチ
379
+ created_date: 2012-02-26 # episode 4
331
380
  transform_message: |-
332
381
  (レディ?)
333
382
  プリキュア・スマイルチャージ!
@@ -341,6 +390,7 @@ cure_march: &cure_march
341
390
  cure_beauty: &cure_beauty
342
391
  human_name: 青木れいか
343
392
  precure_name: キュアビューティ
393
+ created_date: 2012-03-04 # episode 5
344
394
  transform_message: |-
345
395
  (レディ?)
346
396
  プリキュア・スマイルチャージ!
@@ -366,6 +416,7 @@ beauty:
366
416
  cure_heart: &cure_heart
367
417
  human_name: 相田マナ
368
418
  precure_name: キュアハート
419
+ created_date: 2013-02-03 # episode 1
369
420
  transform_message: |-
370
421
  プリキュアラブリンク!
371
422
  L! O! V! E!
@@ -374,9 +425,11 @@ cure_heart: &cure_heart
374
425
  愛を無くした悲しいジコチューさん、
375
426
  このキュアハートがあなたのドキドキ取り戻してみせる!
376
427
  extra_names:
428
+ - キュアハート・エンゲージモード
377
429
  cure_diamond: &cure_diamond
378
430
  human_name: 菱川六花
379
431
  precure_name: キュアダイヤモンド
432
+ created_date: 2013-02-17 # episode 3
380
433
  transform_message: |-
381
434
  プリキュアラブリンク!
382
435
  L! O! V! E!
@@ -388,6 +441,7 @@ cure_diamond: &cure_diamond
388
441
  cure_rosetta: &cure_rosetta
389
442
  human_name: 四葉ありす
390
443
  precure_name: キュアロゼッタ
444
+ created_date: 2013-02-24 # episode 4
391
445
  transform_message: |-
392
446
  プリキュアラブリンク!
393
447
  L! O! V! E!
@@ -399,6 +453,7 @@ cure_rosetta: &cure_rosetta
399
453
  cure_sword: &cure_sword
400
454
  human_name: 剣崎真琴
401
455
  precure_name: キュアソード
456
+ created_date: 2013-02-03 # episode 1
402
457
  transform_message: |-
403
458
  プリキュアラブリンク!
404
459
  L! O! V! E!
@@ -410,6 +465,7 @@ cure_sword: &cure_sword
410
465
  cure_ace: &cure_ace
411
466
  human_name: 円亜久里
412
467
  precure_name: キュアエース
468
+ created_date: 2013-06-30 # episode 22
413
469
  transform_message: |-
414
470
  プリキュアドレスアップ!
415
471
  (キュピラッパー!)
data/config/movies.yml ADDED
@@ -0,0 +1,35 @@
1
+ dx1: &dx1
2
+ title: 映画 プリキュアオールスターズDX みんなともだちっ☆奇跡の全員大集合!
3
+ started_date: 2009-03-20
4
+ dx:
5
+ <<: *dx1
6
+
7
+ dx2: &dx2
8
+ title: 映画 プリキュアオールスターズDX2 希望の光☆レインボージュエルを守れ!
9
+ started_date: 2010-03-20
10
+
11
+ dx3: &dx3
12
+ title: 映画 プリキュアオールスターズDX3 未来にとどけ! 世界をつなぐ☆虹色の花
13
+ started_date: 2011-03-19
14
+
15
+ ns1: &ns1
16
+ title: 映画 プリキュアオールスターズNewStage みらいのともだち
17
+ started_date: 2012-03-17
18
+ ns:
19
+ <<: *ns1
20
+ new_stage:
21
+ <<: *ns1
22
+ new_stage1:
23
+ <<: *ns1
24
+
25
+ ns2: &ns2
26
+ title: 映画 プリキュアオールスターズNewStage2 こころのともだち
27
+ started_date: 2013-03-16
28
+ new_stage2:
29
+ <<: *ns2
30
+
31
+ ns3: &ns3
32
+ title: 映画 プリキュアオールスターズ NewStage3 永遠のともだち
33
+ started_date: 2014-03-15
34
+ new_stage3:
35
+ <<: *ns3
data/lib/rubicure.rb CHANGED
@@ -2,9 +2,11 @@ require "active_support/core_ext"
2
2
  require 'yaml'
3
3
  require 'hashie'
4
4
  require "rubicure/version"
5
+ require "rubicure/concerns/util"
5
6
  require "rubicure/series"
6
7
  require "rubicure/girl"
7
8
  require "rubicure/core"
9
+ require "rubicure/movie"
8
10
 
9
11
  module Rubicure
10
12
  def self.core
@@ -13,8 +15,8 @@ module Rubicure
13
15
  end
14
16
 
15
17
  module Precure
16
- def self.method_missing(name, *args)
17
- Rubicure.core.send(name, *args)
18
+ def self.method_missing(name, *args, &block)
19
+ Rubicure.core.send(name, *args, &block)
18
20
  end
19
21
  end
20
22
 
@@ -0,0 +1,20 @@
1
+ module Rubicure
2
+ module Concerns
3
+ module Util
4
+ # @param arg
5
+ # @return [Date] arg is String or Date
6
+ # @return [Time] arg is Time
7
+ # @return [nil] arg is other
8
+ def to_date(arg)
9
+ case arg
10
+ when Date, Time
11
+ arg
12
+ when String
13
+ Date.parse(arg)
14
+ else
15
+ nil
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
data/lib/rubicure/core.rb CHANGED
@@ -3,6 +3,8 @@ module Rubicure
3
3
 
4
4
  class Core
5
5
  include Singleton
6
+ include Enumerable
7
+ include Rubicure::Concerns::Util
6
8
 
7
9
  def method_missing(name, *args)
8
10
  unmarked_precure = Rubicure::Series::find(:unmarked)
@@ -20,8 +22,7 @@ module Rubicure
20
22
  # @raise not onair!
21
23
  def now
22
24
  current_time = Time.now
23
- Rubicure::Series.names.each do |name|
24
- series = Rubicure::Series.find(name)
25
+ each_with_series do |series|
25
26
  return series if series.on_air?(current_time)
26
27
  end
27
28
  raise "Not on air precure!"
@@ -29,18 +30,42 @@ module Rubicure
29
30
 
30
31
  alias :current :now
31
32
 
33
+ # @param [Time,Date,String,Symbol] arg Time, Date or date like String (ex. "2013-12-16")
32
34
  # @return [Array<Rubicure::Girl>]
33
- def all_stars
35
+ def all_stars(arg=Time.current)
34
36
  unless @all_stars
35
37
  @all_stars = []
36
38
  Rubicure::Girl.names.each do |girl_name|
37
39
  @all_stars << Rubicure::Girl.find(girl_name)
38
40
  end
39
41
 
40
- @all_stars.uniq!{|girl| girl.precure_name }
42
+ @all_stars.uniq!{|girl| girl.human_name }
41
43
  end
42
44
 
43
- @all_stars
45
+ begin
46
+ movie = Rubicure::Movie.find(arg.to_sym)
47
+ date = movie.started_date
48
+ rescue
49
+ # args is Time or Date
50
+ date = to_date(arg)
51
+ end
52
+
53
+ @all_stars.select{|girl| girl.created_date <= date }
54
+ end
55
+
56
+ # iterate with :unmarked, :max_heart, ...
57
+ #
58
+ # @yield series
59
+ # @yieldparam series [Rubicure::Series]
60
+ #
61
+ # @return [Array<Symbol>] ex. :unmarked, :max_heart, ...
62
+ def each_with_series
63
+ Rubicure::Series.uniq_names.each do |series_name|
64
+ series = Rubicure::Series.find(series_name)
65
+ yield series
66
+ end
44
67
  end
68
+
69
+ alias :each :each_with_series
45
70
  end
46
71
  end
data/lib/rubicure/girl.rb CHANGED
@@ -1,15 +1,16 @@
1
1
  module Rubicure
2
2
  class Girl
3
- attr_reader :human_name, :precure_name, :transform_message, :extra_names, :current_state, :state_names
3
+ attr_reader :human_name, :precure_name, :transform_message, :extra_names, :current_state, :state_names, :created_date
4
4
 
5
5
  @@cache = {}
6
6
  @@config = nil
7
7
 
8
- def initialize(human_name: nil, precure_name: nil, transform_message: nil, extra_names: [])
8
+ def initialize(human_name: nil, precure_name: nil, transform_message: nil, extra_names: [], created_date: nil)
9
9
  @human_name = human_name
10
10
  @precure_name = precure_name
11
11
  @transform_message = transform_message
12
12
  @extra_names = extra_names || []
13
+ @created_date = created_date
13
14
  @current_state = 0
14
15
  @state_names = [@human_name, @precure_name]
15
16
  @state_names += @extra_names unless @extra_names.empty?
@@ -0,0 +1,59 @@
1
+ module Rubicure
2
+ class Movie < Hash
3
+ include Hashie::Extensions::MethodAccess
4
+
5
+ @@cache = {}
6
+ @@config = nil
7
+
8
+ # @return [Array<Symbol>]
9
+ def self.names
10
+ config.keys
11
+ end
12
+
13
+ # @return [Array<Symbol>]
14
+ def self.uniq_names
15
+ uniq_names = []
16
+ config.each do |name, series|
17
+ uniq_names << name unless uniq_names.any?{|uniq_name| config[uniq_name][:title] == series[:title] }
18
+ end
19
+ uniq_names
20
+ end
21
+
22
+ # @return [Hash] content of config/movies.yml
23
+ def self.config
24
+ unless @@config
25
+ config_file = "#{File.dirname(__FILE__)}/../../config/movies.yml"
26
+ @@config = YAML.load_file(config_file).deep_symbolize_keys
27
+ end
28
+ @@config
29
+ end
30
+
31
+ # @return [Hash] content of config/movies.yml
32
+ def self.reload_config!
33
+ @@cache = {}
34
+ @@config = nil
35
+ config
36
+ end
37
+
38
+ # @param [Symbol] series_name
39
+ def self.valid?(series_name)
40
+ names.include?(series_name)
41
+ end
42
+
43
+ # @param movie_name [Symbol]
44
+ # @return [Rubicure::Movie]
45
+ # @raise arg is invalid
46
+ def self.find(movie_name)
47
+ raise "unknown movie: #{movie_name}" unless valid?(movie_name)
48
+
49
+ unless @@cache[movie_name]
50
+ movie_config = config[movie_name] || {}
51
+ movie_config.reject! { |k, v| v.nil? }
52
+
53
+ @@cache[movie_name] = Rubicure::Movie[movie_config]
54
+ end
55
+
56
+ @@cache[movie_name]
57
+ end
58
+ end
59
+ end
@@ -1,6 +1,7 @@
1
1
  module Rubicure
2
2
  class Series < Hash
3
3
  include Hashie::Extensions::MethodAccess
4
+ include Rubicure::Concerns::Util
4
5
 
5
6
  @@cache = {}
6
7
  @@config = nil
@@ -98,21 +99,5 @@ module Rubicure
98
99
 
99
100
  @@cache[series_name]
100
101
  end
101
-
102
- private
103
- # @param arg
104
- # @return [Date] arg is String or Date
105
- # @return [Time] arg is Time
106
- # @return [nil] arg is other
107
- def to_date(arg)
108
- case arg
109
- when Date, Time
110
- arg
111
- when String
112
- Date.parse(arg)
113
- else
114
- nil
115
- end
116
- end
117
102
  end
118
103
  end
@@ -1,3 +1,3 @@
1
1
  module Rubicure
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/rubicure.gemspec CHANGED
@@ -23,9 +23,11 @@ Gem::Specification.new do |spec|
23
23
  spec.add_dependency "activesupport", "~> 4.0.1"
24
24
  spec.add_dependency "hashie", "~> 2.0.5"
25
25
 
26
- spec.add_development_dependency "bundler", "~> 1.3"
26
+ spec.add_development_dependency "bundler", ">= 1.3.5"
27
27
  spec.add_development_dependency "rake"
28
28
  spec.add_development_dependency "rspec", "~> 3.0.0.beta1"
29
+ spec.add_development_dependency "rspec-its", "~> 1.0.0.pre"
30
+ spec.add_development_dependency "rspec-collection_matchers", "~> 0.0.2"
29
31
  #spec.add_development_dependency "rspec-parameterized"
30
32
  spec.add_development_dependency "delorean"
31
33
  spec.add_development_dependency "yard"
data/spec/core_spec.rb CHANGED
@@ -9,7 +9,7 @@ describe Rubicure::Core do
9
9
  time_travel_to "2013-01-01"
10
10
  end
11
11
 
12
- it{ expect(subject.title).to eq "スマイルプリキュア!" }
12
+ its(:title){ should == "スマイルプリキュア!" }
13
13
  end
14
14
 
15
15
  context "when not on air" do
@@ -17,15 +17,14 @@ describe Rubicure::Core do
17
17
  time_travel_to "2013-02-01"
18
18
  end
19
19
 
20
- it{ expect{ subject.title }.to raise_error }
20
+ it{ expect{ subject }.to raise_error }
21
21
  end
22
22
  end
23
23
 
24
24
  it "output all precure methods", category: :verbose do
25
- Rubicure::Series.names.each do |series_name|
26
- puts "[#{series_name}] ===================="
27
- series = Rubicure::Series.find(series_name)
25
+ Precure.each_with_series do |series|
28
26
  puts <<EOS
27
+ ====================
29
28
  title: #{series.title}
30
29
  broadcast: #{series.started_date} - #{series.ended_date}
31
30
  girls: #{series.girls.count}
@@ -44,4 +43,60 @@ EOS
44
43
  end
45
44
  end
46
45
  end
46
+
47
+ describe "#each_with_series" do
48
+ before do
49
+ @expected_series = []
50
+ Rubicure::Series.uniq_names.each do |series_name|
51
+ @expected_series << Rubicure::Series.find(series_name)
52
+ end
53
+ end
54
+
55
+ it{ expect{|b| instance.each_with_series(&b) }.to yield_successive_args *@expected_series }
56
+ end
57
+
58
+ describe "#all_stars" do
59
+ context "Without arg" do
60
+ subject{ instance.all_stars }
61
+
62
+ before do
63
+ human_names = []
64
+ config_file = "#{File.dirname(__FILE__)}/../config/girls.yml"
65
+ Pathname(config_file).each_line do |line|
66
+ human_names << $1 if line =~ /human_name:\s*(.+)\s*/
67
+ end
68
+ @precure_count = human_names.uniq.count
69
+ end
70
+
71
+ its(:count){ should == @precure_count }
72
+ end
73
+
74
+ context "With arg" do
75
+ subject{ instance.all_stars(arg) }
76
+
77
+ where(:arg, :expected_count) do
78
+ [
79
+ ["2009-03-20" , 14],
80
+ [Date.parse("2010-03-20"), 17],
81
+ [Time.parse("2011-03-19"), 21],
82
+
83
+ [:dx , 14],
84
+ [:dx1 , 14],
85
+ [:dx2 , 17],
86
+ [:dx3 , 21],
87
+
88
+ [:ns , 28],
89
+ [:ns1 , 28],
90
+ [:new_stage , 28],
91
+ [:new_stage1, 28],
92
+ [:ns2 , 32],
93
+ [:new_stage2, 32],
94
+ ]
95
+ end
96
+
97
+ with_them do
98
+ its(:count){ should == expected_count }
99
+ end
100
+ end
101
+ end
47
102
  end
data/spec/girl_spec.rb CHANGED
@@ -97,14 +97,14 @@ EOF
97
97
  let(:girl_name){ :peace }
98
98
 
99
99
  it{ should be_an_instance_of Rubicure::Girl }
100
- it{ expect(subject.precure_name).to eq "キュアピース" }
100
+ its(:precure_name){ should == "キュアピース" }
101
101
  end
102
102
 
103
103
  describe "#uniq_names" do
104
104
  subject{ Rubicure::Girl.uniq_names }
105
105
 
106
- let(:all_stars_count){ Rubicure.core.all_stars.count }
106
+ let(:containing_name_alias_count){ Rubicure::Girl.names.count }
107
107
 
108
- it{ expect(subject.count).to eq all_stars_count }
108
+ its(:count){ should < containing_name_alias_count }
109
109
  end
110
110
  end
@@ -0,0 +1,42 @@
1
+ describe Rubicure::Movie do
2
+ let(:movie_names) {
3
+ [
4
+ :dx1,
5
+ :dx2,
6
+ :dx3,
7
+ :ns1,
8
+ :ns2,
9
+ :ns3,
10
+ ]
11
+ }
12
+
13
+ describe "#names" do
14
+ subject{ Rubicure::Movie.names }
15
+
16
+ it{ should include *movie_names }
17
+ end
18
+
19
+ describe "#uniq_names" do
20
+ subject{ Rubicure::Movie.uniq_names }
21
+
22
+ it{ should include *movie_names }
23
+ its(:count){ should == movie_names.count }
24
+ end
25
+
26
+ describe "#find" do
27
+ subject{ Rubicure::Movie.find(movie_name) }
28
+
29
+ context "when exists" do
30
+ let(:movie_name){ :dx }
31
+
32
+ its(:title){ should == "映画 プリキュアオールスターズDX みんなともだちっ☆奇跡の全員大集合!" }
33
+ end
34
+
35
+ context "when not exists" do
36
+ let(:movie_name){ :ashita_no_nadja }
37
+
38
+ it{ expect{subject}.to raise_error }
39
+ end
40
+ end
41
+
42
+ end
@@ -109,18 +109,4 @@ describe Rubicure do
109
109
  it{ expect( Milky.rose.precure_name ).to eq "ミルキィローズ"}
110
110
  end
111
111
  end
112
-
113
- describe "#all_stars" do
114
- subject{ Precure.all_stars }
115
-
116
- before do
117
- @precure_count = 0
118
- config_file = "#{File.dirname(__FILE__)}/../config/girls.yml"
119
- Pathname(config_file).each_line do |line|
120
- @precure_count += 1 if line =~ /[a-z_]+:\s*&[a-z_]+/
121
- end
122
- end
123
-
124
- it{ expect(subject.count).to eq @precure_count }
125
- end
126
112
  end
data/spec/series_spec.rb CHANGED
@@ -45,10 +45,7 @@ describe Rubicure::Series do
45
45
  ]
46
46
  }
47
47
 
48
- it'has 5 girls' do
49
- expect(subject.size).to eq(5)
50
- end
51
-
48
+ it{ should have_exactly(5).girls }
52
49
  it{ should array_instance_of Rubicure::Girl }
53
50
  end
54
51
 
@@ -105,17 +102,17 @@ describe Rubicure::Series do
105
102
  subject{ Rubicure::Series.uniq_names }
106
103
 
107
104
  it{ should include *series_names }
108
- it{ expect(subject.count).to eq series_names.count }
105
+ its(:count){ should == series_names.count }
109
106
  end
110
107
 
111
108
  describe "#find" do
112
- subject(:series){ Rubicure::Series.find(series_name) }
109
+ subject{ Rubicure::Series.find(series_name) }
113
110
 
114
111
  context "when exists" do
115
112
  let(:series_name){ :smile }
116
113
 
117
- it{ expect(series.title).to eq "スマイルプリキュア!" }
118
- it{ expect(series.girls.count).to eq 5 }
114
+ its(:title){ should == "スマイルプリキュア!" }
115
+ its(:girls){ should have_exactly(5).girls }
119
116
  end
120
117
 
121
118
  context "when not exists" do
data/spec/spec_helper.rb CHANGED
@@ -8,6 +8,8 @@ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
8
8
  require 'rubicure'
9
9
  require 'rspec'
10
10
  require 'rspec-parameterized'
11
+ require 'rspec/its'
12
+ require 'rspec/collection_matchers'
11
13
  require 'delorean'
12
14
 
13
15
  # Requires supporting ruby files with custom matchers and macros, etc,
metadata CHANGED
@@ -1,139 +1,167 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubicure
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - sue445
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-22 00:00:00.000000000 Z
11
+ date: 2014-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: 4.0.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 4.0.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: hashie
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: 2.0.5
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 2.0.5
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '1.3'
47
+ version: 1.3.5
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '1.3'
54
+ version: 1.3.5
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: 3.0.0.beta1
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
82
  version: 3.0.0.beta1
83
+ - !ruby/object:Gem::Dependency
84
+ name: rspec-its
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: 1.0.0.pre
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: 1.0.0.pre
97
+ - !ruby/object:Gem::Dependency
98
+ name: rspec-collection_matchers
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: 0.0.2
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: 0.0.2
83
111
  - !ruby/object:Gem::Dependency
84
112
  name: delorean
85
113
  requirement: !ruby/object:Gem::Requirement
86
114
  requirements:
87
- - - '>='
115
+ - - ">="
88
116
  - !ruby/object:Gem::Version
89
117
  version: '0'
90
118
  type: :development
91
119
  prerelease: false
92
120
  version_requirements: !ruby/object:Gem::Requirement
93
121
  requirements:
94
- - - '>='
122
+ - - ">="
95
123
  - !ruby/object:Gem::Version
96
124
  version: '0'
97
125
  - !ruby/object:Gem::Dependency
98
126
  name: yard
99
127
  requirement: !ruby/object:Gem::Requirement
100
128
  requirements:
101
- - - '>='
129
+ - - ">="
102
130
  - !ruby/object:Gem::Version
103
131
  version: '0'
104
132
  type: :development
105
133
  prerelease: false
106
134
  version_requirements: !ruby/object:Gem::Requirement
107
135
  requirements:
108
- - - '>='
136
+ - - ">="
109
137
  - !ruby/object:Gem::Version
110
138
  version: '0'
111
139
  - !ruby/object:Gem::Dependency
112
140
  name: codeclimate-test-reporter
113
141
  requirement: !ruby/object:Gem::Requirement
114
142
  requirements:
115
- - - '>='
143
+ - - ">="
116
144
  - !ruby/object:Gem::Version
117
145
  version: '0'
118
146
  type: :development
119
147
  prerelease: false
120
148
  version_requirements: !ruby/object:Gem::Requirement
121
149
  requirements:
122
- - - '>='
150
+ - - ">="
123
151
  - !ruby/object:Gem::Version
124
152
  version: '0'
125
153
  - !ruby/object:Gem::Dependency
126
154
  name: coveralls
127
155
  requirement: !ruby/object:Gem::Requirement
128
156
  requirements:
129
- - - '>='
157
+ - - ">="
130
158
  - !ruby/object:Gem::Version
131
159
  version: '0'
132
160
  type: :development
133
161
  prerelease: false
134
162
  version_requirements: !ruby/object:Gem::Requirement
135
163
  requirements:
136
- - - '>='
164
+ - - ">="
137
165
  - !ruby/object:Gem::Version
138
166
  version: '0'
139
167
  description: All about Japanese battle heroine "Pretty Cure (Precure)".
@@ -143,26 +171,30 @@ executables: []
143
171
  extensions: []
144
172
  extra_rdoc_files: []
145
173
  files:
146
- - .coveralls.yml
147
- - .gitignore
148
- - .rspec
149
- - .travis.yml
150
- - .yardopts
174
+ - ".coveralls.yml"
175
+ - ".gitignore"
176
+ - ".rspec"
177
+ - ".travis.yml"
178
+ - ".yardopts"
151
179
  - CHANGELOG.md
152
180
  - Gemfile
153
181
  - LICENSE.txt
154
182
  - README.md
155
183
  - Rakefile
156
184
  - config/girls.yml
185
+ - config/movies.yml
157
186
  - config/series.yml
158
187
  - lib/rubicure.rb
188
+ - lib/rubicure/concerns/util.rb
159
189
  - lib/rubicure/core.rb
160
190
  - lib/rubicure/girl.rb
191
+ - lib/rubicure/movie.rb
161
192
  - lib/rubicure/series.rb
162
193
  - lib/rubicure/version.rb
163
194
  - rubicure.gemspec
164
195
  - spec/core_spec.rb
165
196
  - spec/girl_spec.rb
197
+ - spec/movie_spec.rb
166
198
  - spec/rubicure_spec.rb
167
199
  - spec/series_spec.rb
168
200
  - spec/spec_helper.rb
@@ -177,23 +209,24 @@ require_paths:
177
209
  - lib
178
210
  required_ruby_version: !ruby/object:Gem::Requirement
179
211
  requirements:
180
- - - '>='
212
+ - - ">="
181
213
  - !ruby/object:Gem::Version
182
214
  version: 2.0.0
183
215
  required_rubygems_version: !ruby/object:Gem::Requirement
184
216
  requirements:
185
- - - '>='
217
+ - - ">="
186
218
  - !ruby/object:Gem::Version
187
219
  version: '0'
188
220
  requirements: []
189
221
  rubyforge_project:
190
- rubygems_version: 2.0.14
222
+ rubygems_version: 2.2.0
191
223
  signing_key:
192
224
  specification_version: 4
193
225
  summary: All about Japanese battle heroine "Pretty Cure (Precure)".
194
226
  test_files:
195
227
  - spec/core_spec.rb
196
228
  - spec/girl_spec.rb
229
+ - spec/movie_spec.rb
197
230
  - spec/rubicure_spec.rb
198
231
  - spec/series_spec.rb
199
232
  - spec/spec_helper.rb