Skip to content

Commit

Permalink
Merge pull request #135 from sue445/feature/full_name
Browse files Browse the repository at this point in the history
Impl Girl#full_name
  • Loading branch information
sue445 committed Jan 10, 2017
2 parents e9aa699 + 7301fb7 commit f560e96
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 19 deletions.
24 changes: 24 additions & 0 deletions README.md
Expand Up @@ -390,6 +390,30 @@ mirai.attack!
プリキュア!ルビーパッショナーレ!
```

### full_name
When `Rubicure::Girl` has `human_full_name` (i.e. another `human_name`), she returns as `#full_name`

```ruby
Cure.princess.human_name
# => "白雪ひめ"
Cure.princess.full_name
# => "ヒメルダ・ウインドウ・キュアクイーン・オブ・ザ・ブルースカイ"

Cure.scarlet.human_name
# => "紅城トワ"
Cure.scarlet.full_name
# => "プリンセス・ホープ・ディライト・トワ"
```

`#full_name` returns `#human_name` when she doe's not have `human_full_name`

```ruby
Cure.miracle.human_name
# => "朝日奈みらい"
Cure.miracle.full_name
# => "朝日奈みらい"
```

### Precure allstars
```ruby
Precure.all_stars.count
Expand Down
13 changes: 7 additions & 6 deletions config/girls/011_happiness_charge.yml
Expand Up @@ -36,12 +36,13 @@ cure_lovely: &cure_lovely
transform_calls:
- kururin_mirror_change
cure_princess: &cure_princess
girl_name: cure_princess
human_name: 白雪ひめ
precure_name: キュアプリンセス
cast_name: 潘めぐみ
created_date: 2014-02-02 # episode 1
color: blue
girl_name: cure_princess
human_name: 白雪ひめ
human_full_name: ヒメルダ・ウインドウ・キュアクイーン・オブ・ザ・ブルースカイ
precure_name: キュアプリンセス
cast_name: 潘めぐみ
created_date: 2014-02-02 # episode 1
color: blue
transform_message: |-
(かわルンルン!)
プリキュアくるりんミラーチェンジ!
Expand Down
15 changes: 8 additions & 7 deletions config/girls/012_go_princess.yml
Expand Up @@ -71,13 +71,14 @@ cure_twinkle: &cure_twinkle
transform_calls:
- princess_engage
cure_scarlet: &cure_scarlet
girl_name: cure_scarlet
human_name: 紅城トワ
precure_name: キュアスカーレット
cast_name: 沢城みゆき
color: red
created_date: 2015-07-05 # episode 22
birthday: 12/15
girl_name: cure_scarlet
human_name: 紅城トワ
human_full_name: プリンセス・ホープ・ディライト・トワ
precure_name: キュアスカーレット
cast_name: 沢城みゆき
color: red
created_date: 2015-07-05 # episode 22
birthday: 12/15
transform_message: |-
プリキュア!プリンセスエンゲージ!
深紅の炎のプリンセス!キュアスカーレット!
Expand Down
13 changes: 7 additions & 6 deletions examples/all.rb
Expand Up @@ -11,12 +11,13 @@
series.girls.each do |girl|
puts <<EOS
------------------------
human_name: #{girl.human_name}
precure_name: #{girl.precure_name}
cast_name: #{girl.cast_name}
color: #{girl.color}
extra_names: #{girl[:extra_names]}
state_names: #{girl.state_names}
human_name: #{girl.human_name}
human_full_name: #{girl.human_full_name}
precure_name: #{girl.precure_name}
cast_name: #{girl.cast_name}
color: #{girl.color}
extra_names: #{girl[:extra_names]}
state_names: #{girl.state_names}
attack_messages: #{girl.attack_messages}
transform_message:
#{girl.transform_message}
Expand Down
5 changes: 5 additions & 0 deletions lib/rubicure/girl.rb
Expand Up @@ -10,6 +10,7 @@ class Girl < Hash
ATTRIBUTES = [
:girl_name,
:human_name,
:human_full_name,
:precure_name,
:cast_name,
:color,
Expand Down Expand Up @@ -87,6 +88,10 @@ def have_birthday? # rubocop:disable Style/PredicateName
end
alias_method :has_birthday?, :have_birthday?

def full_name
human_full_name.presence || human_name
end

ATTRIBUTES.each do |attribute|
define_method attribute do
if @current_transform_style
Expand Down
14 changes: 14 additions & 0 deletions spec/girl_spec.rb
Expand Up @@ -311,4 +311,18 @@
it { should be false }
end
end

describe "#full_name" do
subject { girl.full_name }

context "has human_full_name" do
let(:girl) { Cure.scarlet }

it { should eq "プリンセス・ホープ・ディライト・トワ" }
end

context "don't have human_full_name" do
it { should eq "黄瀬やよい" }
end
end
end

0 comments on commit f560e96

Please sign in to comment.