syoboi_calendar 0.9.0 → 0.9.1

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: b67926b1fd893f4d44887464f9b8d160d7789032
4
- data.tar.gz: c1df3c20468b121b117ef08e3a42a79075aa0aec
3
+ metadata.gz: 1c6a3bc9030335c46951f952b015f41bcc659156
4
+ data.tar.gz: 2006ec81adcb5ebc472ac68fe9d083a01e312c17
5
5
  SHA512:
6
- metadata.gz: 977d4653b70a7e7fde5ddaf83c25c759854d6b9c41325e3e1653f42fcb0fa35d7baf2e86b7dca1762d28ce5fb51ff7b7408a2b86ab1fd6e5a414c5a29bafa067
7
- data.tar.gz: '058558e1d50597c9938b84d94743bddd5e6957d38151874d71848a69092c394aa2bb61a073061c455b0ea6f7563283779085eb525a9b36bd333541eeb270c010'
6
+ metadata.gz: 6c7b75cb9c9b4791087d4d4eb461222d8599fbc380cc8733d79edc8a028faf478ecd3cf16fcc66db808c5f7a42b315740beb7049befcfcc319fca1ccc855641b
7
+ data.tar.gz: 5bae958e577c981b030465ebb3daa12626187b231fc0593b197de95ee886e2c2f1e760b159f81ce2c6155938d8f64c6a3c4a0e24cd80fdfbd5a7434af5dcd2de
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.9.1
2
+
3
+ - Fix bug on personality role name splitting
4
+ - Change `SyoboiCalendar::Song` interface
5
+
1
6
  ## 0.9.0
2
7
 
3
8
  - Add `SyoboiCalendar::Resources::TitleResource#casts`
data/README.md CHANGED
@@ -128,7 +128,7 @@ Available methods:
128
128
 
129
129
  ### SyoboiCalendar::Resources::ChannelGroupResource
130
130
 
131
- Available attributes:
131
+ Available methods:
132
132
 
133
133
  - `#comment`
134
134
  - `#id`
@@ -137,7 +137,7 @@ Available attributes:
137
137
 
138
138
  ### SyoboiCalendar::Resources::ChannelResource
139
139
 
140
- Available attributes:
140
+ Available methods:
141
141
 
142
142
  - `#channel_group_id`
143
143
  - `#comment`
@@ -150,7 +150,7 @@ Available attributes:
150
150
 
151
151
  ### SyoboiCalendar::Resources::ProgramResource
152
152
 
153
- Available attributes:
153
+ Available methods:
154
154
 
155
155
  - `#channel_id`
156
156
  - `#comment`
@@ -168,7 +168,7 @@ Available attributes:
168
168
 
169
169
  ### SyoboiCalendar::Resources::TitleResource
170
170
 
171
- Available attributes:
171
+ Available methods:
172
172
 
173
173
  - `#casts`
174
174
  - `#category_id`
@@ -1,11 +1,13 @@
1
1
  module SyoboiCalendar
2
2
  class CommentSection
3
- NAME_CASTS = "キャスト"
4
- NAME_STAFFS = "スタッフ"
3
+ PATTERN_NAME_CASTS = "キャスト"
4
+ PATTERN_NAME_STAFFS = "スタッフ"
5
5
  PATTERN_NAME_SONG_ENDING = /\Aエンディング\d*\s*「(.+)」\z/
6
6
  PATTERN_NAME_SONG_INSERTED = /\A挿入歌\d*\s*「(.+)」\z/
7
7
  PATTERN_NAME_SONG_OPENING = /\Aオープニング\d*\s*「(.+)」\z/
8
8
  PATTERN_NAME_SONG_THEME = /\A主題歌\d*\s*「(.+)」\z/
9
+ PATTERN_SONG_NAME = /「(.+)」/
10
+ PATTERN_SONG_ROLE = /(\S+)\s*「.+」/
9
11
 
10
12
  attr_reader :source
11
13
 
@@ -14,6 +16,19 @@ module SyoboiCalendar
14
16
  @source = source
15
17
  end
16
18
 
19
+ # @return [Boolean]
20
+ def about_casts?
21
+ PATTERN_NAME_CASTS === name
22
+ end
23
+
24
+ # @return [Boolean]
25
+ def about_song?
26
+ about_song_ending? ||
27
+ about_song_inserted? ||
28
+ about_song_opening? ||
29
+ about_song_theme?
30
+ end
31
+
17
32
  # @return [Boolean]
18
33
  def about_song_ending?
19
34
  PATTERN_NAME_SONG_ENDING === name
@@ -34,19 +49,16 @@ module SyoboiCalendar
34
49
  PATTERN_NAME_SONG_THEME === name
35
50
  end
36
51
 
37
- # @return [Boolean]
38
- def about_casts?
39
- name == NAME_CASTS
40
- end
41
-
42
52
  # @return [Boolean]
43
53
  def about_personalities?
44
- about_casts? || about_staffs?
54
+ about_casts? ||
55
+ about_song? ||
56
+ about_staffs?
45
57
  end
46
58
 
47
59
  # @return [Boolean]
48
60
  def about_staffs?
49
- name == NAME_STAFFS
61
+ PATTERN_NAME_STAFFS === name
50
62
  end
51
63
 
52
64
  # @return [Array<String>]
@@ -68,10 +80,8 @@ module SyoboiCalendar
68
80
  # @return [Hash{String => String}]
69
81
  def hash
70
82
  lines[1..-1].grep(/\A:/).each_with_object({}) do |line, result|
71
- key_or_keys, value = line[1..-1].split(":", 2)
72
- key_or_keys.split("").each do |key|
73
- result[key] = value.split("、")
74
- end
83
+ key, value = line[1..-1].split(":", 2)
84
+ result[key] = value.split("")
75
85
  end
76
86
  end
77
87
 
@@ -99,9 +109,22 @@ module SyoboiCalendar
99
109
  # @return [Hash]
100
110
  def song_attributes
101
111
  {
102
- name: name,
103
- source: hash,
112
+ name: song_name,
113
+ role: song_role,
114
+ personalities: personalities,
104
115
  }
105
116
  end
117
+
118
+ # @return [String, nil]
119
+ def song_name
120
+ if about_song?
121
+ name[PATTERN_SONG_NAME, 1]
122
+ end
123
+ end
124
+
125
+ # @return [String, nil]
126
+ def song_role
127
+ name[PATTERN_SONG_ROLE, 1]
128
+ end
106
129
  end
107
130
  end
@@ -1,40 +1,21 @@
1
1
  module SyoboiCalendar
2
2
  class Song
3
- KEY_ARRANGERS = "編曲"
4
- KEY_COMPOSERS = "作曲"
5
- KEY_LYRIC_WRITERS = "作詞"
6
-
7
3
  # @return [String]
8
4
  attr_reader :name
9
5
 
10
- # @param name [String]
11
- # @param source [Hash]
12
- def initialize(name:, source:)
13
- @name = name
14
- @source = source
15
- end
6
+ # @return [Array<SyoboiCalendar::Personality>]
7
+ attr_reader :personalities
16
8
 
17
- # @return [Array<String>]
18
- def arrangers
19
- source[KEY_ARRANGERS]
20
- end
21
-
22
- # @return [Array<String>]
23
- def composers
24
- source[KEY_COMPOSERS]
25
- end
26
-
27
- # @return [Array<String>]
28
- def lyric_writers
29
- source[KEY_LYRIC_WRITERS]
30
- end
31
-
32
- private
9
+ # @return [String]
10
+ attr_reader :role
33
11
 
34
- # @private
35
- # @return [Hash]
36
- def source
37
- @source
12
+ # @param name [String]
13
+ # @param personalities [Array<SyoboiCalendar::Personality>]
14
+ # @param role [String]
15
+ def initialize(name:, personalities:, role:)
16
+ @name = name
17
+ @personalities = personalities
18
+ @role = role
38
19
  end
39
20
  end
40
21
  end
@@ -1,3 +1,3 @@
1
1
  module SyoboiCalendar
2
- VERSION = "0.9.0"
2
+ VERSION = "0.9.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syoboi_calendar
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-11 00:00:00.000000000 Z
11
+ date: 2017-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday