lucarecord 0.3.0 → 0.4.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: 9ed7b48ed86166e5a300510832dff02e9e51d4fd3184aeaa4b1c73b663845631
4
- data.tar.gz: a2b03908af268809a66a08e600994064f5a1bf9cda2610f94f9f849b5d981188
3
+ metadata.gz: fde3b4057d40252d43320a4f55acae976faff31b608a71e66ebcfec0ad8c592a
4
+ data.tar.gz: 89764a7a57b4aff62e4a48a64a418b7f5991ab4f6d9358eb6ea1fc476f7d6b7e
5
5
  SHA512:
6
- metadata.gz: 1cefaa9401e153e6cd7f628c8141265b172ca3cec2606294b691a08acc6860c46b76ed60739f1f8ac1e40dc57e8def103d507d5b917fa3713c118bc8e333888e
7
- data.tar.gz: b85f03f247270a7d87ab7635bf7e0dc73ecaf0f33af37660ce666d1f287259274c612112f77305f3ad317a823324058290b81d5a19e7e47c947f88d6d598788e
6
+ metadata.gz: b58faff8563d38ceeb1e632381ec67487a7fd3b38d7473998f36605a4bfdd2a9bcaab25471348fa63b7a30a8f1bacb3f917421b8a1bcdabe4fc985f93a7342a2
7
+ data.tar.gz: 2de6368ee308eb4c20ddfd97e93544f5d1d2ae3f3b45f7937d2ab925cbd82d03748332fa9d502e536ed3953028cdf6caa522d73f418e28a24bc45c45e74d16d0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## LucaRecord 0.4.0
2
+
3
+ * Replace YAML.load/load_file to YAML.safe_load for compatibility with Ruby 3.1
4
+
1
5
  ## LucaRecord 0.3.0
2
6
 
3
7
  * implement LucaRecord::IO.latest_month
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'csv'
4
+ require 'date'
4
5
  require 'fileutils'
5
6
  require 'yaml'
6
7
  require 'pathname'
@@ -71,7 +72,7 @@ module LucaRecord
71
72
  when '.tsv', '.csv'
72
73
  load_tsv_dict(dict_path(file))
73
74
  when '.yaml', '.yml'
74
- YAML.load_file(dict_path(file), **{})
75
+ YAML.safe_load(File.read(dict_path(file)), permitted_classes: [Date])
75
76
  else
76
77
  raise 'cannot load this filetype'
77
78
  end
@@ -150,7 +150,7 @@ module LucaRecord # :nodoc:
150
150
 
151
151
  def add_status!(id, status, basedir = @dirname)
152
152
  path = abs_path(basedir) / id2path(id)
153
- origin = YAML.load_file(path, **{})
153
+ origin = YAML.safe_load(File.read(path), permitted_classes: [Date])
154
154
  newline = { status => DateTime.now.to_s }
155
155
  origin['status'] = [] if origin['status'].nil?
156
156
  origin['status'] << newline
@@ -362,7 +362,7 @@ module LucaRecord # :nodoc:
362
362
  # TODO: implement JSON parse
363
363
  end
364
364
  else
365
- LucaSupport::Code.decimalize(YAML.load(io.read)).tap { |obj| validate_keys(obj) }
365
+ LucaSupport::Code.decimalize(YAML.safe_load(io.read, permitted_classes: [Date])).tap { |obj| validate_keys(obj) }
366
366
  end
367
367
  end
368
368
 
@@ -434,7 +434,7 @@ module LucaRecord # :nodoc:
434
434
  def load_config(path = nil)
435
435
  path = path.to_s
436
436
  if File.exist?(path)
437
- YAML.load_file(path, **{})
437
+ YAML.safe_load(File.read(path), permitted_classes: [Date])
438
438
  else
439
439
  {}
440
440
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LucaRecord
4
- VERSION = '0.3.0'
4
+ VERSION = '0.4.0'
5
5
  end
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require 'date'
3
4
  require 'pathname'
4
5
  require 'yaml'
5
6
 
@@ -11,7 +12,7 @@ module LucaSupport
11
12
  {
12
13
  'decimal_separator' => '.',
13
14
  'thousands_separator' => ','
14
- }.merge(YAML.load_file(Pathname(PJDIR) / 'config.yml'))
15
+ }.merge(YAML.safe_load(File.read(Pathname(PJDIR) / 'config.yml'), permitted_classes: [Date]))
15
16
  rescue Errno::ENOENT
16
17
  {
17
18
  'decimal_separator' => '.',
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lucarecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chuma Takahiro
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-16 00:00:00.000000000 Z
11
+ date: 2022-04-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mail