lucarecord 0.5.4 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/luca_record/io.rb +11 -8
- data/lib/luca_record/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4574038ef165ecd098bd37897f77a16edb5917aa6c157ce45a005598bc540af2
|
4
|
+
data.tar.gz: a2f22d1d3c9899e3c84c7662cb8859794541e31cbd116eae343deb4d4db3e415
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 05dccaddb053508040dfab00cd9451b20b10d3a9b78a5317609ab8e71a548109cee9c4ff2579132f2e7380bb470d8639e6ddfb80ffdb23e324c2971e89d596d0
|
7
|
+
data.tar.gz: e33237c779d1450bd6c1b9a1c208382a8eda87848da74117b36bc973b93c44b965e1970d8eea60eb0d83698361406700c4dbe1480d511bc0130ece78cf7c6cf3
|
data/CHANGELOG.md
CHANGED
data/lib/luca_record/io.rb
CHANGED
@@ -4,6 +4,7 @@ require 'bigdecimal'
|
|
4
4
|
require 'csv'
|
5
5
|
require 'date'
|
6
6
|
require 'fileutils'
|
7
|
+
require 'json'
|
7
8
|
require 'yaml'
|
8
9
|
require 'pathname'
|
9
10
|
require 'luca_support/code'
|
@@ -427,14 +428,16 @@ module LucaRecord # :nodoc:
|
|
427
428
|
# If specific decode is needed, override this method in each class.
|
428
429
|
#
|
429
430
|
def load_data(io, path = nil)
|
430
|
-
if @record_type
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
431
|
+
raw_obj = if @record_type
|
432
|
+
case @record_type
|
433
|
+
when 'json'
|
434
|
+
JSON.parse(io.read)
|
435
|
+
end
|
436
|
+
else
|
437
|
+
YAML.safe_load(io.read, permitted_classes: [Date])
|
438
|
+
end
|
439
|
+
LucaSupport::Code.decimalize(raw_obj)
|
440
|
+
.tap { |obj| validate_keys(obj) }
|
438
441
|
end
|
439
442
|
|
440
443
|
def validate_keys(obj)
|
data/lib/luca_record/version.rb
CHANGED
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.5.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chuma Takahiro
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-04-
|
11
|
+
date: 2023-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|