syobocal 0.14.0 → 0.15.0

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
  SHA256:
3
- metadata.gz: 737c5456c21b70925571795e9b8f81b35ba89738065dfaec3332c11d3920e19f
4
- data.tar.gz: 26ef1a657a390e37fef06c2a0ac7ed681a3bbd951fb6f779f248a61bc08aaddd
3
+ metadata.gz: a7c70f8c43481ff45aa94a288afc6efa6148e54bc5e2e30013c54a3e298f873b
4
+ data.tar.gz: 60692a1fbdf68e2f4acded6208706a1ac86e9d6934eb72f25858b9d12cd512ca
5
5
  SHA512:
6
- metadata.gz: cb49862e127d7abba99f6a09fe93e2f357d4e331243e6236314c23c1d9e5384cd39af7501009c77ab07ac0a7f8a00ae71082f5f5b6fbb1060da31051160d03b7
7
- data.tar.gz: 3aaf9a0a8bdfbf76e703608dadbd97d6f6971ec787772e0507aeeae47109dc179654e5fd56c4e50e0b691df8df5c8cd3525f7395d42c0e43f68de059038efa60
6
+ metadata.gz: 3b2733ca8dd5ebaa5b7b52b84cc44235da6f460bf7516e647e12ae4225df629d6d2e8e45a914681671d53b5886d6fbdbadcee6ce3c77f5a7c0cc9e8c177bd622
7
+ data.tar.gz: d18ea750bc40dfc21b0a791df14d32fdc35a3fd49c460808922d205c36d229afd7fa4785b835a1539f81a35bf2578e70bcab2e92f1a752efb21a6f96a00e70b7
@@ -2,9 +2,9 @@ module Syobocal
2
2
  module Comment
3
3
  module Helper
4
4
  class Fragment
5
- CHILD_BEGIN = '('
6
- CHILD_END = ')'
7
- SEPARATOR = ''
5
+ CHILD_BEGIN = "("
6
+ CHILD_END = ")"
7
+ SEPARATOR = ""
8
8
 
9
9
  attr_reader :text, :child, :following
10
10
 
@@ -42,7 +42,7 @@ module Syobocal
42
42
  end
43
43
 
44
44
  def pretty_output(level = 0)
45
- line = level.times.map{' '}.join
45
+ line = level.times.map { " " }.join
46
46
 
47
47
  line << text
48
48
 
@@ -66,7 +66,7 @@ module Syobocal
66
66
  end
67
67
 
68
68
  def to_s
69
- to_a.map{|f|
69
+ to_a.map { |f|
70
70
  if f.child
71
71
  "#{f.text}(#{f.child.to_s})"
72
72
  else
@@ -76,21 +76,25 @@ module Syobocal
76
76
  private
77
77
 
78
78
  def create_staff_list(rows)
79
- rows.map do |row|
79
+ staffs = rows.map do |row|
80
80
  role = row.attr_node.inner_text
81
81
  people = row.value_node.split.map { |str| Person.parse(str) }
82
82
 
83
- Staff.new(role, people)
83
+ Staff.new(role, people.select(&:valid?))
84
84
  end
85
+
86
+ staffs.select { |staff| !staff.people.empty? }
85
87
  end
86
88
 
87
89
  def create_cast_list(rows)
88
- rows.map do |row|
90
+ casts = rows.map do |row|
89
91
  character = row.attr_node.inner_text
90
92
  people = row.value_node.split.map { |str| Person.parse(str) }
91
93
 
92
- Cast.new(character, people)
94
+ Cast.new(character, people.select(&:valid?))
93
95
  end
96
+
97
+ casts.select { |cast| !cast.people.empty? }
94
98
  end
95
99
 
96
100
  def create_musics(sections)
@@ -14,14 +14,18 @@ module Syobocal
14
14
  other.instance_of?(self.class) && other.name == name && other.note == note
15
15
  end
16
16
 
17
+ def valid?
18
+ !name.nil? && !name.empty?
19
+ end
20
+
17
21
  def self.parse(str)
18
22
  _, name, note = *(str.match(/\A([^\(\)]+?)(?:\((.*?)\))?\Z/).to_a)
19
23
 
20
- Person.new(name, note)
24
+ Person.new(name&.strip, note&.strip)
21
25
  end
22
26
 
23
27
  def self.multi_parse(str)
24
- Helper::Fragment.parse(str).to_a.map{|f|
28
+ Helper::Fragment.parse(str).to_a.map { |f|
25
29
  name = f.text
26
30
  note = f&.child&.to_s
27
31
 
@@ -10,7 +10,7 @@ module Syobocal
10
10
  def parse
11
11
  return @parse if defined? @parse
12
12
 
13
- @sub_titles.each_line.each_with_object([]){|line, array|
13
+ @sub_titles.each_line.each_with_object([]) { |line, array|
14
14
  m = FORMAT_REGEXP.match(line)
15
15
 
16
16
  array << SubTitle.new(m[1], m[2]) if m
@@ -1,3 +1,3 @@
1
1
  module Syobocal
2
- VERSION = "0.14.0"
2
+ VERSION = "0.15.0"
3
3
  end
data/syobocal.gemspec CHANGED
@@ -1,4 +1,3 @@
1
-
2
1
  lib = File.expand_path("../lib", __FILE__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require "syobocal/version"
@@ -27,9 +26,8 @@ Gem::Specification.new do |spec|
27
26
  spec.add_development_dependency "rake", ">= 13.0"
28
27
  spec.add_development_dependency "minitest", "~> 5.0"
29
28
  spec.add_development_dependency "rufo", "~> 0.7"
30
- spec.add_dependency "open-uri", "~> 0.2"
31
29
  spec.add_dependency "rexml", "~> 3.2"
32
30
  spec.add_dependency "rss", "~> 0.2"
33
31
 
34
- spec.required_ruby_version = ">= 3.0.0"
32
+ spec.required_ruby_version = ">= 3.1.0"
35
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: syobocal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - xmisao
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-02 00:00:00.000000000 Z
11
+ date: 2022-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,20 +66,6 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0.7'
69
- - !ruby/object:Gem::Dependency
70
- name: open-uri
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '0.2'
76
- type: :runtime
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '0.2'
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: rexml
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -172,14 +158,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
158
  requirements:
173
159
  - - ">="
174
160
  - !ruby/object:Gem::Version
175
- version: 3.0.0
161
+ version: 3.1.0
176
162
  required_rubygems_version: !ruby/object:Gem::Requirement
177
163
  requirements:
178
164
  - - ">="
179
165
  - !ruby/object:Gem::Version
180
166
  version: '0'
181
167
  requirements: []
182
- rubygems_version: 3.2.3
168
+ rubygems_version: 3.3.7
183
169
  signing_key:
184
170
  specification_version: 4
185
171
  summary: Simple gem for Syoboi Calendar