rubicure 1.2.0 → 1.2.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5bd479bd674464c40c3f4121e5ba390e1b8a4f6081ac7aa4e0b8562e6e1d1aaa
4
- data.tar.gz: 40b9e4c8a48237235203b511debe2223c030f13430e2b7066b3149b3ec601492
3
+ metadata.gz: 45f94f4a60d24f3e8eeb3a9e3091d3ab239cc517ec338114e9b324b21a0fe51c
4
+ data.tar.gz: dd4b009d7885a965a1eff4a2d179a7704fbeddacff68029ff83a700893ecdffe
5
5
  SHA512:
6
- metadata.gz: 32532bef14075cf9535440dfb2ff14e39f29b36764b86941332f8cfe8ccb47c9e914f9cf16be1421642134d4384287ae7cf3d77872cf894e5d7e329dc28d8f8e
7
- data.tar.gz: deb6593c3e7be45fb83c401f7c9f49587e24cbfebc9f7fc42b8b7b9bc5a93aedeed0e7ee4d352854166730c6f0c49171bcb94aee222600398eac3afa356c7036
6
+ metadata.gz: 3efda1c3a9e31189b39ef4fe4e65980c332843492ecd12cd7c4e9126cf6d7df3223575f4f936c177f2bcb407df23e3ab718804b3affd416de8c464bff5cdaab2
7
+ data.tar.gz: e97d921f933c84b468d8cdeb0ecf7f1d6c28272a1292ac4b5a1d467ff7ee4b1318c3e79f309556439bf48f9861fc99f37babee09b13dee1390fe6af2a81da148
@@ -1,5 +1,13 @@
1
1
  ## master
2
- [full changelog](http://github.com/sue445/rubicure/compare/v1.2.0...master)
2
+ [full changelog](http://github.com/sue445/rubicure/compare/v1.2.1...master)
3
+
4
+ ## v1.2.1
5
+ [full changelog](http://github.com/sue445/rubicure/compare/v1.2.0...v1.2.1)
6
+
7
+ * Tweak transform message of Star twinkle precure
8
+ * https://github.com/sue445/rubicure/pull/203
9
+ * Impl `heisei?` and `reiwa?` methods
10
+ * https://github.com/sue445/rubicure/pull/204
3
11
 
4
12
  ## v1.2.0
5
13
  [full changelog](http://github.com/sue445/rubicure/compare/v1.1.10...v1.2.0)
data/Gemfile CHANGED
@@ -5,4 +5,7 @@ gemspec
5
5
 
6
6
  if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.3.0")
7
7
  gem "backport_dig"
8
+
9
+ # i18n v1.5.1+ requires Ruby 2.3.0+
10
+ gem "i18n", "< 1.5.1"
8
11
  end
data/README.md CHANGED
@@ -714,6 +714,27 @@ Go!プリンセスプリキュア
714
714
 
715
715
  * `has_birthday?` is alias to `have_birthday?`
716
716
 
717
+ ### `Rubicure::Girl#heisei?` and `Rubicure::Girl#reiwa?`
718
+ ```ruby
719
+ >> Cure.star.heisei?
720
+ => true
721
+ >> Cure.star.reiwa?
722
+ => false
723
+ ```
724
+
725
+ ### `Rubicure::Series#heisei?` and `Rubicure::Series#reiwa?`
726
+ ```ruby
727
+ >> Precure.hugtto.heisei?
728
+ => true
729
+ >> Precure.hugtto.reiwa?
730
+ => false
731
+
732
+ >> Precure.star_twinkle.heisei?
733
+ => true
734
+ >> Precure.star_twinkle.reiwa?
735
+ => true
736
+ ```
737
+
717
738
  ## More reference
718
739
  http://rubydoc.info/gems/rubicure/frames
719
740
 
@@ -20,6 +20,7 @@ cure_star: &cure_star
20
20
  スター☆トゥインクル!プリキュア!
21
21
  あー!
22
22
  宇宙に輝くキラキラ星!キュアスター!
23
+ スター☆トゥインクル!プリキュア!
23
24
  # extra_names:
24
25
  attack_messages:
25
26
  - |-
@@ -51,6 +52,7 @@ cure_milky: &cure_milky
51
52
  スター☆トゥインクル!プリキュア!
52
53
  あー!
53
54
  天にあまねくミルキーウェイ!キュアミルキー!
55
+ スター☆トゥインクル!プリキュア!
54
56
  # extra_names:
55
57
  attack_messages:
56
58
  - |-
@@ -82,6 +84,7 @@ cure_soleil: &cure_soleil
82
84
  スター☆トゥインクル!プリキュア!
83
85
  あー!
84
86
  宇宙を照らす!灼熱のきらめき!キュアソレイユ!
87
+ スター☆トゥインクル!プリキュア!
85
88
  # extra_names:
86
89
  attack_messages:
87
90
  - |-
@@ -113,6 +116,7 @@ cure_selene: &cure_selene
113
116
  スター☆トゥインクル!プリキュア!
114
117
  あー!
115
118
  夜空に輝く!神秘の月あかり!キュアセレーネ!
119
+ スター☆トゥインクル!プリキュア!
116
120
  # extra_names:
117
121
  attack_messages:
118
122
  - |-
@@ -3,6 +3,7 @@ require "yaml"
3
3
  require "hashie"
4
4
  require "rubicure/version"
5
5
  require "rubicure/concerns/util"
6
+ require "rubicure/concerns/gengou"
6
7
  require "rubicure/series"
7
8
  require "rubicure/girl"
8
9
  require "rubicure/core"
@@ -0,0 +1,17 @@
1
+ module Rubicure
2
+ module Concerns
3
+ module Gengou
4
+ refine Date do
5
+ # Whether current date is Heisei
6
+ def heisei?
7
+ Date.new(1989, 1, 8) <= self && self <= Date.new(2019, 4, 30)
8
+ end
9
+
10
+ # Whether current date is Reiwa
11
+ def reiwa?
12
+ Date.new(2019, 5, 1) <= self
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -7,6 +7,8 @@ module Rubicure
7
7
  class Girl < Hash # rubocop:disable Metrics/ClassLength
8
8
  include Hashie::Extensions::MethodAccess
9
9
 
10
+ using Rubicure::Concerns::Gengou
11
+
10
12
  ATTRIBUTES = [
11
13
  :girl_name,
12
14
  :human_name,
@@ -161,6 +163,16 @@ module Rubicure
161
163
  human_full_name.presence || human_name
162
164
  end
163
165
 
166
+ # Whether Heisei precure
167
+ def heisei?
168
+ created_date.heisei?
169
+ end
170
+
171
+ # Whether Reiwa precure
172
+ def reiwa?
173
+ created_date.reiwa?
174
+ end
175
+
164
176
  ATTRIBUTES.each do |attribute|
165
177
  define_method attribute do
166
178
  if @current_transform_style
@@ -6,6 +6,8 @@ module Rubicure
6
6
  include Rubicure::Concerns::Util
7
7
  include Enumerable
8
8
 
9
+ using Rubicure::Concerns::Gengou
10
+
9
11
  @cache = {}
10
12
  @config = nil
11
13
 
@@ -71,6 +73,19 @@ module Rubicure
71
73
  original_hash.to_json
72
74
  end
73
75
 
76
+ # Whether Heisei precure
77
+ def heisei?
78
+ started_date.heisei? || ended_date.heisei?
79
+ end
80
+
81
+ # Whether Reiwa precure
82
+ def reiwa?
83
+ # TODO: Remove after StarTwinkle Precure is finished
84
+ return true unless has_key?(:ended_date)
85
+
86
+ started_date.reiwa? || ended_date.reiwa?
87
+ end
88
+
74
89
  class << self
75
90
  # @return [Array<Symbol>]
76
91
  def names
@@ -1,3 +1,3 @@
1
1
  module Rubicure
2
- VERSION = "1.2.0".freeze
2
+ VERSION = "1.2.1".freeze
3
3
  end
@@ -0,0 +1,37 @@
1
+ describe Rubicure::Concerns::Gengou do
2
+ using Rubicure::Concerns::Gengou
3
+
4
+ describe "Date#heisei?" do
5
+ subject { date(str).heisei? }
6
+
7
+ using RSpec::Parameterized::TableSyntax
8
+
9
+ where(:str, :expected) do
10
+ "1989-01-07" | false
11
+ "1989-01-08" | true
12
+ "2019-04-30" | true
13
+ "2019-05-01" | false
14
+ end
15
+
16
+ with_them do
17
+ it { should eq expected }
18
+ end
19
+ end
20
+
21
+ describe "Date#reiwa?" do
22
+ subject { date(str).reiwa? }
23
+
24
+ using RSpec::Parameterized::TableSyntax
25
+
26
+ where(:str, :expected) do
27
+ "1989-01-07" | false
28
+ "1989-01-08" | false
29
+ "2019-04-30" | false
30
+ "2019-05-01" | true
31
+ end
32
+
33
+ with_them do
34
+ it { should eq expected }
35
+ end
36
+ end
37
+ end
@@ -21,7 +21,7 @@ describe Rubicure::Girl do
21
21
  let(:human_name) { "黄瀬やよい" }
22
22
  let(:precure_name) { "キュアピース" }
23
23
  let(:cast_name) { "金元寿子" }
24
- let(:created_date) { "2012-02-19" }
24
+ let(:created_date) { date("2012-02-19") }
25
25
  let(:extra_names) { %w[プリンセスピース ウルトラピース] }
26
26
  let(:color) { "yellow" }
27
27
  let(:transform_message) do
@@ -331,4 +331,17 @@ JANKEN
331
331
  it { should eq "黄瀬やよい" }
332
332
  end
333
333
  end
334
+
335
+ describe "#heisei?" do
336
+ subject { girl.heisei? }
337
+
338
+ it { should eq true }
339
+ end
340
+
341
+ describe "#reiwa?" do
342
+ subject { girl.reiwa? }
343
+
344
+ # TODO: Add reiwa precure test after cure cosmo is added
345
+ it { should eq false }
346
+ end
334
347
  end
@@ -154,4 +154,38 @@ describe Rubicure::Series do
154
154
 
155
155
  it { should eq json.squish }
156
156
  end
157
+
158
+ describe "#heisei?" do
159
+ subject { series.heisei? }
160
+
161
+ using RSpec::Parameterized::TableSyntax
162
+
163
+ let(:series) { Rubicure::Series.find(series_name) }
164
+
165
+ where(:series_name, :expected) do
166
+ :hugtto | true
167
+ :star_twinkle | true
168
+ end
169
+
170
+ with_them do
171
+ it { should eq expected }
172
+ end
173
+ end
174
+
175
+ describe "#reiwa?" do
176
+ subject { series.reiwa? }
177
+
178
+ using RSpec::Parameterized::TableSyntax
179
+
180
+ let(:series) { Rubicure::Series.find(series_name) }
181
+
182
+ where(:series_name, :expected) do
183
+ :hugtto | false
184
+ :star_twinkle | true
185
+ end
186
+
187
+ with_them do
188
+ it { should eq expected }
189
+ end
190
+ end
157
191
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubicure
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - sue445
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-03 00:00:00.000000000 Z
11
+ date: 2019-06-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -300,6 +300,7 @@ files:
300
300
  - config/movies.yml
301
301
  - config/series.yml
302
302
  - lib/rubicure.rb
303
+ - lib/rubicure/concerns/gengou.rb
303
304
  - lib/rubicure/concerns/util.rb
304
305
  - lib/rubicure/core.rb
305
306
  - lib/rubicure/cure.rb
@@ -312,6 +313,7 @@ files:
312
313
  - rubicure.gemspec
313
314
  - spec/config/girls_checker_spec.rb
314
315
  - spec/config/series_checker_spec.rb
316
+ - spec/rubicure/concerns/gengou_spec.rb
315
317
  - spec/rubicure/core_spec.rb
316
318
  - spec/rubicure/cure_spec.rb
317
319
  - spec/rubicure/girl_spec.rb
@@ -350,6 +352,7 @@ summary: All about Japanese battle heroine "Pretty Cure (Precure)".
350
352
  test_files:
351
353
  - spec/config/girls_checker_spec.rb
352
354
  - spec/config/series_checker_spec.rb
355
+ - spec/rubicure/concerns/gengou_spec.rb
353
356
  - spec/rubicure/core_spec.rb
354
357
  - spec/rubicure/cure_spec.rb
355
358
  - spec/rubicure/girl_spec.rb