nhkore 0.3.16 → 0.3.18

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: f23192b04fc6a0c1cf225db4a029e3226346d27c4fe977ee05f1b522c40708bb
4
- data.tar.gz: 3e71d5ef9eb60327cb9ced89a819de77b5cd8910e755332d5764dc95e8263f71
3
+ metadata.gz: 6c5e1fbcf5bb3f6dc23b6595e4138efb68597ac79cd01dac27cd242b914153ea
4
+ data.tar.gz: 7608824e45a76a69175cf272e1301cfd062845a9de916b9034c0c4d13df73bb3
5
5
  SHA512:
6
- metadata.gz: 2cec06bd51e86ddd7b30a052b4078a2932344996bd6d97c4b7d927d0bc8fbcecbd2fb21680957551857d3a152d33409aa7ee8e1dd496a271cb31c63cbe2eb2e9
7
- data.tar.gz: 186c42412e35567aebe2afee71636fb58a28510bd6ab3e8b65df6adef5373860f25e87be71e5d8499dcf6b6babb0ee3aae796a01f818732bc53ad682e584e701
6
+ metadata.gz: 119c88fdd9377f96fe6bf3816d2c0b7eacbd5002fa2f0d8c852d8179f9058b8a8182ea5c828dbc61032647ac797c20289456144b30d0c5172a8be9ae527ffa14
7
+ data.tar.gz: 73e2e75d1f4d444fe0fc9ade55bff57aaaa8876e5978aad62a925536bac8b0cf2a1d5db39d2ddfd5de9f5e65e95aa30adadbee70608111e1b2e310b6fd840e8b
data/.yardopts CHANGED
@@ -1,3 +1,3 @@
1
- --files 'CHANGELOG.md,LICENSE.txt'
1
+ --files 'LICENSE.txt,CHANGELOG.md'
2
2
  --protected
3
3
  --readme 'README.md'
data/CHANGELOG.md CHANGED
@@ -5,10 +5,30 @@ All notable changes to this project will be documented in this file.
5
5
  Format is based on [Keep a Changelog v1.0.0](https://keepachangelog.com/en/1.0.0),
6
6
  and this project adheres to [Semantic Versioning v2.0.0](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [[Unreleased]](https://github.com/esotericpig/nhkore/compare/v0.3.16...HEAD)
8
+ ## [[Unreleased]](https://github.com/esotericpig/nhkore/compare/v0.3.18...HEAD)
9
9
  -
10
10
 
11
11
 
12
+ ## [v0.3.18] - 2025-04-24
13
+
14
+ ### Changed
15
+ - Changed Nokogiri gem version to `~> 1`, instead of `~> 1.xx`, as I got tired of the security alerts. Now, it will always be up-to-date and secure.
16
+ - Updated gems.
17
+ - Removed `yard_ghurt` gem.
18
+ - Applied new RuboCop suggestions.
19
+
20
+ ### Fixed
21
+ - Bing no longer allows `count`, so removed it. No workaround/fix for now....
22
+ - New NHK Easy pages no longer have a dictionary, so changed it to only warn instead of an exception.
23
+
24
+
25
+ ## [v0.3.17] - 2024-09-03
26
+
27
+ ### Changed
28
+ - Upgraded min Ruby version to 3.1 (lowest that is not EOL).
29
+ - Updated gems.
30
+
31
+
12
32
  ## [v0.3.16] - 2024-08-14
13
33
 
14
34
  ### Fixed
data/Gemfile CHANGED
@@ -1,7 +1,19 @@
1
1
  # encoding: UTF-8
2
2
  # frozen_string_literal: true
3
3
 
4
-
5
4
  source 'https://rubygems.org'
6
5
 
7
6
  gemspec
7
+
8
+ group :development,:test do
9
+ gem 'bundler' ,'~> 2.6'
10
+ gem 'rake' ,'~> 13.2'
11
+ gem 'raketeer' ,'~> 0.2' # Extra Rake tasks.
12
+ gem 'rdoc' ,'~> 6.13' # YARDoc RDoc (*.rb).
13
+ gem 'redcarpet','~> 3.6' # YARDoc Markdown (*.md).
14
+ gem 'yard' ,'~> 0.9' # YARDoc doc.
15
+ end
16
+
17
+ group :test do
18
+ gem 'minitest','~> 5.25'
19
+ end
data/Gemfile.lock CHANGED
@@ -1,20 +1,21 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nhkore (0.3.16)
4
+ nhkore (0.3.18)
5
5
  attr_bool (~> 0.2)
6
6
  bimyou_segmenter (~> 1.2)
7
7
  cri (~> 2.15)
8
+ csv (~> 3.3)
8
9
  down (~> 5.4)
9
10
  highline (~> 3.1)
10
11
  http-cookie (~> 1.0)
11
12
  japanese_deinflector (~> 0.0)
12
- nokogiri (~> 1.16)
13
+ nokogiri (~> 1)
13
14
  psychgus (~> 1.3)
14
15
  public_suffix (~> 6.0)
15
16
  rainbow (~> 3.1)
16
17
  rss (~> 0.3)
17
- rubyzip (~> 2.3)
18
+ rubyzip (~> 2.4)
18
19
  tiny_segmenter (~> 0.0)
19
20
  tty-progressbar (~> 0.18)
20
21
  tty-spinner (~> 0.9)
@@ -27,23 +28,26 @@ GEM
27
28
  attr_bool (0.2.2)
28
29
  bimyou_segmenter (1.2.0)
29
30
  cri (2.15.12)
31
+ csv (3.3.4)
32
+ date (3.4.1)
30
33
  domain_name (0.6.20240107)
31
34
  down (5.4.2)
32
35
  addressable (~> 2.8)
33
- highline (3.1.0)
36
+ highline (3.1.2)
34
37
  reline
35
- http-cookie (1.0.6)
38
+ http-cookie (1.0.8)
36
39
  domain_name (~> 0.5)
37
- io-console (0.7.2)
40
+ io-console (0.8.0)
38
41
  japanese_deinflector (0.0.2)
39
- mini_portile2 (2.8.7)
40
- minitest (5.25.0)
41
- nokogiri (1.16.7)
42
+ mini_portile2 (2.8.8)
43
+ minitest (5.25.5)
44
+ nokogiri (1.18.8)
42
45
  mini_portile2 (~> 2.8.2)
43
46
  racc (~> 1.4)
44
- psych (5.1.2)
47
+ psych (5.2.3)
48
+ date
45
49
  stringio
46
- psychgus (1.3.4)
50
+ psychgus (1.3.5)
47
51
  psych (>= 3.0)
48
52
  public_suffix (6.0.1)
49
53
  racc (1.8.1)
@@ -51,22 +55,20 @@ GEM
51
55
  rake (13.2.1)
52
56
  raketeer (0.2.13)
53
57
  rake
54
- rdoc (6.7.0)
58
+ rdoc (6.13.1)
55
59
  psych (>= 4.0.0)
56
- redcarpet (3.6.0)
57
- reline (0.5.9)
60
+ redcarpet (3.6.1)
61
+ reline (0.6.1)
58
62
  io-console (~> 0.5)
59
- rexml (3.3.5)
60
- strscan
63
+ rexml (3.4.1)
61
64
  rss (0.3.1)
62
65
  rexml
63
- rubyzip (2.3.2)
64
- stringio (3.1.1)
66
+ rubyzip (2.4.1)
67
+ stringio (3.1.7)
65
68
  strings-ansi (0.2.0)
66
- strscan (3.1.0)
67
69
  tiny_segmenter (0.0.6)
68
70
  tty-cursor (0.7.1)
69
- tty-progressbar (0.18.2)
71
+ tty-progressbar (0.18.3)
70
72
  strings-ansi (~> 0.2)
71
73
  tty-cursor (~> 0.7)
72
74
  tty-screen (~> 0.8)
@@ -74,25 +76,21 @@ GEM
74
76
  tty-screen (0.8.2)
75
77
  tty-spinner (0.9.3)
76
78
  tty-cursor (~> 0.7)
77
- unicode-display_width (2.5.0)
78
- yard (0.9.36)
79
- yard_ghurt (1.2.1)
80
- rake
81
- yard
79
+ unicode-display_width (2.6.0)
80
+ yard (0.9.37)
82
81
 
83
82
  PLATFORMS
84
83
  ruby
85
84
 
86
85
  DEPENDENCIES
87
- bundler (~> 2.5)
86
+ bundler (~> 2.6)
88
87
  minitest (~> 5.25)
89
88
  nhkore!
90
89
  rake (~> 13.2)
91
90
  raketeer (~> 0.2)
92
- rdoc (~> 6.7)
91
+ rdoc (~> 6.13)
93
92
  redcarpet (~> 3.6)
94
93
  yard (~> 0.9)
95
- yard_ghurt (~> 1.2)
96
94
 
97
95
  BUNDLED WITH
98
- 2.5.17
96
+ 2.6.8
data/Rakefile CHANGED
@@ -1,7 +1,6 @@
1
1
  # encoding: UTF-8
2
2
  # frozen_string_literal: true
3
3
 
4
-
5
4
  require 'bundler/gem_tasks'
6
5
 
7
6
  require 'rake/clean'
@@ -9,46 +8,41 @@ require 'rake/testtask'
9
8
  require 'raketeer/irb'
10
9
  require 'raketeer/nokogiri_installs'
11
10
  require 'yard'
12
- require 'yard_ghurt'
13
11
 
14
12
  require 'nhkore/util'
15
13
  require 'nhkore/version'
16
14
 
17
-
18
15
  PKG_DIR = 'pkg'
19
16
 
20
17
  CLEAN.exclude('{.git,core,stock}/**/*')
21
- CLOBBER.include('doc/',File.join(PKG_DIR,''))
22
-
18
+ CLOBBER.include('doc/',"#{PKG_DIR}/")
23
19
 
24
- task default: [:test]
20
+ task default: %i[test]
25
21
 
26
22
  desc 'Generate documentation (YARDoc)'
27
- task doc: %i[yard yard_gfm_fix] do |task|
28
- end
23
+ task doc: %i[yard]
29
24
 
30
- desc "Package '#{File.join(NHKore::Util::CORE_DIR,'')}' data as a Zip file into '#{File.join(PKG_DIR,'')}'"
31
- task :pkg_core do |task|
25
+ desc "Package '#{NHKore::Util::CORE_DIR}/' data as a Zip file into '#{PKG_DIR}/'"
26
+ task :pkg_core do |_task|
32
27
  mkdir_p PKG_DIR
33
28
 
34
- pattern = File.join(NHKore::Util::CORE_DIR,'*.{csv,html,json,yml}')
29
+ pattern = "#{NHKore::Util::CORE_DIR}/*.{csv,html,json,yml}"
35
30
  zip_file = File.join(PKG_DIR,'nhkore-core.zip')
36
31
 
37
- sh 'zip','-9rv',zip_file,*Dir.glob(pattern).sort
32
+ sh 'zip','-9rv',zip_file,*Dir.glob(pattern)
38
33
  end
39
34
 
40
35
  Rake::TestTask.new do |task|
41
- task.libs = ['lib','test']
42
- task.pattern = File.join('test','**','*_test.rb')
43
- task.description += ": '#{task.pattern}'"
36
+ task.libs = %w[lib test]
37
+ task.pattern = 'test/**/*_test.rb'
44
38
  task.verbose = false
45
39
  task.warning = true
46
40
  end
47
41
 
48
42
  # If you need to run a part after the 1st part,
49
43
  # just type 'n' to not overwrite the file and then 'y' for continue.
50
- desc "Update '#{File.join(NHKore::Util::CORE_DIR,'')}' files for release"
51
- task :update_core do |task|
44
+ desc "Update '#{NHKore::Util::CORE_DIR}/' files for release"
45
+ task :update_core do |_task|
52
46
  require 'highline'
53
47
 
54
48
  continue_msg = "\nContinue (y/n)? "
@@ -63,7 +57,7 @@ task :update_core do |task|
63
57
  next unless hl.agree(continue_msg)
64
58
  puts
65
59
 
66
- next unless sh(*cmd,'news','-s','1000','ez')
60
+ next unless sh(*cmd,'news','-s','1000','ez','--lenient')
67
61
  next unless hl.agree(continue_msg)
68
62
  puts
69
63
 
@@ -78,7 +72,7 @@ task :update_core do |task|
78
72
  end
79
73
 
80
74
  desc 'Update showcase file for release'
81
- task :update_showcase do |task|
75
+ task :update_showcase do |_task|
82
76
  require 'highline'
83
77
 
84
78
  showcase_file = File.join('.','nhkore-ez.html')
@@ -86,43 +80,16 @@ task :update_showcase do |task|
86
80
  hl = HighLine.new
87
81
 
88
82
  next unless sh('ruby','-w','./lib/nhkore.rb',
89
- 'sift','ez','--no-eng',
90
- '--out',showcase_file,
91
- )
83
+ 'sift','ez','--no-eng',
84
+ '--out',showcase_file)
85
+
86
+ dest_dir = File.join('..','esotericpig.github.io','showcase','')
92
87
 
93
- next unless hl.agree("\nMove the file (y/n)? ")
88
+ next unless hl.agree("\nMove the file to '#{dest_dir}' (y/n)? ")
94
89
  puts
95
- next unless sh('mv','-iv',showcase_file,
96
- File.join('..','esotericpig.github.io','showcase',''),
97
- )
90
+ next unless sh('mv','-iv',showcase_file,dest_dir)
98
91
  end
99
92
 
100
93
  YARD::Rake::YardocTask.new do |task|
101
- task.options += ['--template-path',File.join('yard','templates')]
102
94
  task.options += ['--title',"NHKore v#{NHKore::VERSION} Doc"]
103
95
  end
104
-
105
- # Execute "rake yard_gfm_fix" for production.
106
- # Execute "rake yard_gfm_fix[true]" for testing locally.
107
- YardGhurt::GFMFixTask.new do |task|
108
- task.arg_names = [:dev]
109
- task.dry_run = false
110
- task.fix_code_langs = true
111
- task.md_files = ['index.html']
112
-
113
- task.before = proc do |t,args|
114
- # Delete this file as it's never used (index.html is an exact copy).
115
- YardGhurt::Util.rm_exist(File.join(t.doc_dir,'file.README.html'))
116
-
117
- # Root dir of my GitHub Page for CSS/JS.
118
- ghp_root = YardGhurt::Util.to_bool(args.dev) ? '../../esotericpig.github.io' : '../../..'
119
-
120
- t.css_styles << %Q(<link rel="stylesheet" type="text/css" href="#{ghp_root}/css/prism.css" />)
121
- t.js_scripts << %Q(<script src="#{ghp_root}/js/prism.js"></script>)
122
- end
123
- end
124
-
125
- # Probably not useful for others.
126
- YardGhurt::GHPSyncTask.new do |task|
127
- task.ghp_dir = '../esotericpig.github.io/docs/nhkore/yardoc'
128
- end
data/bin/nhkore CHANGED
@@ -9,8 +9,6 @@
9
9
  # SPDX-License-Identifier: LGPL-3.0-or-later
10
10
  #++
11
11
 
12
-
13
12
  require 'nhkore'
14
13
 
15
-
16
14
  NHKore.run
data/lib/nhkore/app.rb CHANGED
@@ -8,7 +8,6 @@
8
8
  # SPDX-License-Identifier: LGPL-3.0-or-later
9
9
  #++
10
10
 
11
-
12
11
  require 'cri'
13
12
  require 'highline'
14
13
  require 'rainbow'
@@ -25,7 +24,6 @@ require 'nhkore/cli/news_cmd'
25
24
  require 'nhkore/cli/search_cmd'
26
25
  require 'nhkore/cli/sift_cmd'
27
26
 
28
-
29
27
  module NHKore
30
28
  module CLI
31
29
  end
@@ -40,7 +38,7 @@ module NHKore
40
38
  @color = color
41
39
  end
42
40
 
43
- def color?(io)
41
+ def color?(_io)
44
42
  return @color
45
43
  end
46
44
  end
@@ -73,7 +71,7 @@ module NHKore
73
71
  attr_accessor :sleep_time
74
72
  attr_accessor :spinner
75
73
 
76
- def initialize(args=ARGV)
74
+ def initialize(args = ARGV)
77
75
  super()
78
76
 
79
77
  @args = args
@@ -150,13 +148,13 @@ module NHKore
150
148
  This is similar to a core word/vocabulary list.
151
149
  DESC
152
150
 
153
- flag :s,:'classic-fx',<<-DESC do |value,cmd|
151
+ flag :s,:'classic-fx',<<-DESC do |_value,_cmd|
154
152
  use classic spinner/progress special effects (in case of no Unicode support) when running long tasks
155
153
  DESC
156
154
  app.progress_bar = :classic
157
155
  app.spinner = CLASSIC_SPINNER
158
156
  end
159
- flag COLOR_OPTS[0],COLOR_OPTS[1],"force color output (for commands like '| less -R')" do |value,cmd|
157
+ flag COLOR_OPTS[0],COLOR_OPTS[1],"force color output (for commands like '| less -R')" do |_value,_cmd|
160
158
  app.enable_color(true)
161
159
  end
162
160
  flag :n,:'dry-run',<<-DESC
@@ -164,11 +162,11 @@ module NHKore
164
162
  DESC
165
163
  # Big F because dangerous.
166
164
  flag :F,:force,"force overwriting files, creating directories, etc. (don't prompt); dangerous!"
167
- flag :h,:help,'show this help' do |value,cmd|
165
+ flag :h,:help,'show this help' do |_value,cmd|
168
166
  puts cmd.help
169
167
  exit
170
168
  end
171
- option :m,:'max-retry',<<-DESC,argument: :required,default: 3 do |value,cmd|
169
+ option :m,:'max-retry',<<-DESC,argument: :required,default: 3 do |value,_cmd|
172
170
  maximum number of times to retry URLs (-1 or integer >= 0)
173
171
  DESC
174
172
  value = value.to_i
@@ -176,14 +174,14 @@ module NHKore
176
174
 
177
175
  app.scraper_kargs[:max_retries] = value
178
176
  end
179
- flag NO_COLOR_OPTS[0],NO_COLOR_OPTS[1],'disable color output' do |value,cmd|
177
+ flag NO_COLOR_OPTS[0],NO_COLOR_OPTS[1],'disable color output' do |_value,_cmd|
180
178
  app.enable_color(false)
181
179
  end
182
- flag :X,:'no-fx','disable spinner/progress special effects when running long tasks' do |value,cmd|
180
+ flag :X,:'no-fx','disable spinner/progress special effects when running long tasks' do |_value,_cmd|
183
181
  app.progress_bar = :no
184
182
  app.spinner = {} # Still outputs status & stores tokens
185
183
  end
186
- option :o,:'open-timeout',<<-DESC,argument: :required do |value,cmd|
184
+ option :o,:'open-timeout',<<-DESC,argument: :required do |value,_cmd|
187
185
  seconds for URL open timeouts (-1 or decimal >= 0)
188
186
  DESC
189
187
  value = value.to_f
@@ -191,7 +189,7 @@ module NHKore
191
189
 
192
190
  app.scraper_kargs[:open_timeout] = value
193
191
  end
194
- option :r,:'read-timeout',<<-DESC,argument: :required do |value,cmd|
192
+ option :r,:'read-timeout',<<-DESC,argument: :required do |value,_cmd|
195
193
  seconds for URL read timeouts (-1 or decimal >= 0)
196
194
  DESC
197
195
  value = value.to_f
@@ -199,13 +197,13 @@ module NHKore
199
197
 
200
198
  app.scraper_kargs[:read_timeout] = value
201
199
  end
202
- option :z,:sleep,<<-DESC,argument: :required,default: DEFAULT_SLEEP_TIME do |value,cmd|
200
+ option :z,:sleep,<<-DESC,argument: :required,default: DEFAULT_SLEEP_TIME do |value,_cmd|
203
201
  seconds to sleep per scrape (i.e., per page/article) so don't get banned (i.e., fake being human)
204
202
  DESC
205
203
  app.sleep_time = value.to_f
206
204
  app.sleep_time = 0.0 if app.sleep_time < 0.0
207
205
  end
208
- option :t,:timeout,<<-DESC,argument: :required do |value,cmd|
206
+ option :t,:timeout,<<-DESC,argument: :required do |value,_cmd|
209
207
  seconds for all URL timeouts: [open, read] (-1 or decimal >= 0)
210
208
  DESC
211
209
  value = value.to_f
@@ -214,7 +212,7 @@ module NHKore
214
212
  app.scraper_kargs[:open_timeout] = value
215
213
  app.scraper_kargs[:read_timeout] = value
216
214
  end
217
- option :u,:'user-agent',<<-DESC,argument: :required do |value,cmd|
215
+ option :u,:'user-agent',<<-DESC,argument: :required do |value,_cmd|
218
216
  HTTP header field 'User-Agent' to use instead of a random one
219
217
  DESC
220
218
  value = app.check_empty_opt(:'user-agent',value)
@@ -222,12 +220,12 @@ module NHKore
222
220
  app.scraper_kargs[:header] ||= {}
223
221
  app.scraper_kargs[:header]['user-agent'] = value
224
222
  end
225
- flag :v,:version,'show the version and exit' do |value,cmd|
223
+ flag :v,:version,'show the version and exit' do |_value,_cmd|
226
224
  app.show_version
227
225
  exit
228
226
  end
229
227
 
230
- run do |opts,args,cmd|
228
+ run do |_opts,_args,cmd|
231
229
  puts cmd.help
232
230
  end
233
231
  end
@@ -253,21 +251,20 @@ module NHKore
253
251
  file = Util.strip_web_str(@cmd_opts[opt_key].to_s)
254
252
 
255
253
  if file.empty?
256
- # Do not check default_dir.empty?().
257
- if default_filename.empty?
258
- file = nil # nil is very important for BingScraper.init()!
259
- else
260
- file = File.join(default_dir,default_filename)
261
- end
254
+ # Do not check `default_dir.empty?()`.
255
+ file = if default_filename.empty?
256
+ nil # NOTE: nil is very important for BingScraper.init()!
257
+ else
258
+ File.join(default_dir,default_filename)
259
+ end
260
+ # Directory?
261
+ elsif File.directory?(file) || Util.dir_str?(file)
262
+ file = File.join(file,default_filename)
263
+ # File name only? (no directory)
264
+ elsif Util.filename_str?(file)
265
+ file = File.join(default_dir,file)
262
266
  else
263
- # Directory?
264
- if File.directory?(file) || Util.dir_str?(file)
265
- file = File.join(file,default_filename)
266
- # File name only? (no directory)
267
- elsif Util.filename_str?(file)
268
- file = File.join(default_dir,file)
269
- end
270
- # Else, passed in both: 'directory/file'
267
+ # Passed in both: 'directory/file'
271
268
  end
272
269
 
273
270
  # '~' will expand to home, etc.
@@ -307,7 +304,7 @@ module NHKore
307
304
  config.head = 'o'
308
305
  end
309
306
 
310
- #config.frequency = 5 # For a big download, set this
307
+ # config.frequency = 5 # For a big download, set this
311
308
  config.interval = 1 if download
312
309
  end
313
310
  end
@@ -325,7 +322,7 @@ module NHKore
325
322
  aliases :v
326
323
  summary "Show the version and exit (aliases: #{app.color_alias('v')})"
327
324
 
328
- run do |opts,args,cmd|
325
+ run do |_opts,_args,_cmd|
329
326
  app.show_version
330
327
  end
331
328
  end
@@ -501,14 +498,15 @@ module NHKore
501
498
  # this due to relying on @cmd_opts[:ext] to be nil.
502
499
  # It's easy to change this one instance, but I'm not sure
503
500
  # at the moment where else might be affected
504
- ## Cri has a default proc for default values
505
- ## that doesn't store the keys.
506
- #new_opts.default_proc = proc do |hash,key|
507
- # # :max_retry => %s(max-retry)
508
- # key = key.to_s.gsub('_','-').to_sym
509
501
  #
510
- # opts.default_proc.call(hash,key)
511
- #end
502
+ # # Cri has a default proc for default values
503
+ # # that doesn't store the keys.
504
+ # new_opts.default_proc = proc do |hash,key|
505
+ # # :max_retry => %s(max-retry)
506
+ # key = key.to_s.gsub('_','-').to_sym
507
+ #
508
+ # opts.default_proc.call(hash,key)
509
+ # end
512
510
 
513
511
  @cmd = cmd
514
512
  @cmd_args = args
@@ -547,7 +545,7 @@ module NHKore
547
545
 
548
546
  def stop_spin
549
547
  if @spinner.is_a?(Hash)
550
- puts (NO_SPINNER_MSG % @spinner) + ' done!'
548
+ puts "#{NO_SPINNER_MSG % @spinner} done!"
551
549
  else
552
550
  @spinner.reset
553
551
  @spinner.stop('done!')
@@ -586,7 +584,7 @@ module NHKore
586
584
  @tokens[:progress] = 0
587
585
  end
588
586
 
589
- def advance(progress=1)
587
+ def advance(progress = 1)
590
588
  total = @tokens[:total]
591
589
  progress = @tokens[:progress] + progress
592
590
  progress = total if progress > total
@@ -8,13 +8,11 @@
8
8
  # SPDX-License-Identifier: LGPL-3.0-or-later
9
9
  #++
10
10
 
11
-
12
11
  require 'time'
13
12
 
14
13
  require 'nhkore/util'
15
14
  require 'nhkore/word'
16
15
 
17
-
18
16
  module NHKore
19
17
  class Article
20
18
  attr_reader :datetime
@@ -69,7 +67,7 @@ module NHKore
69
67
  coder[:words] = @words
70
68
  end
71
69
 
72
- def self.load_data(key,hash)
70
+ def self.load_data(_key,hash)
73
71
  words = hash[:words]
74
72
 
75
73
  article = Article.new
@@ -80,7 +78,7 @@ module NHKore
80
78
  article.title = hash[:title]
81
79
  article.url = hash[:url]
82
80
 
83
- words&.each() do |k,h|
81
+ words&.each do |k,h|
84
82
  k = k.to_s # Change from a symbol
85
83
  article.words[k] = Word.load_data(k,h)
86
84
  end
@@ -89,11 +87,11 @@ module NHKore
89
87
  end
90
88
 
91
89
  def datetime=(value)
92
- if value.is_a?(Time)
93
- @datetime = value
94
- else
95
- @datetime = Util.empty_web_str?(value) ? nil : Time.iso8601(value)
96
- end
90
+ @datetime = if value.is_a?(Time)
91
+ value
92
+ else
93
+ Util.empty_web_str?(value) ? nil : Time.iso8601(value)
94
+ end
97
95
  end
98
96
 
99
97
  def futsuurl=(value)
@@ -118,7 +116,7 @@ module NHKore
118
116
 
119
117
  if !mini
120
118
  s << "\n words:"
121
- @words.each do |key,word|
119
+ @words.each do |_key,word|
122
120
  s << "\n #{word}"
123
121
  end
124
122
  end