data_crate 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/crate/crate.rb +4 -0
- data/lib/crate/raw.rb +21 -10
- data/lib/crate/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: 9e3ddcfe423a88007b72ca2cefdd511af4d810d915ad1df090b640b1ea8c04ce
|
4
|
+
data.tar.gz: 500831be31b52904d059debb6e470fcab23bbe8da785122c38b777bdb5c26008
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d756de23b6697dc316f5c08935430e4522114bd067e76760082d0dec7c2e30ca3df2f9abdf5e861fe46f0f5ffc87e70d3cfc35293019409885cf262b9f5a6667
|
7
|
+
data.tar.gz: 979b48ab961b5b36fc49206273542be1a55ca0654900fb79acd2e3e73ff1daee617a13b522c80d7400d897a7f3deace5bd6c57895242b3b4761228209c3437c8
|
data/Gemfile.lock
CHANGED
data/lib/crate/crate.rb
CHANGED
data/lib/crate/raw.rb
CHANGED
@@ -48,18 +48,29 @@ module Crate
|
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
|
+
def symbolize(object)
|
52
|
+
case object
|
53
|
+
when Hash
|
54
|
+
object.map { |key, value| [key.to_sym, symbolize(value)] }.to_h
|
55
|
+
else
|
56
|
+
object
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
def make_hash(raw)
|
61
|
+
case raw
|
62
|
+
when String
|
63
|
+
JSON.parse(gsub(raw), symbolize_names: true)
|
64
|
+
when Hash
|
65
|
+
raw
|
66
|
+
else
|
67
|
+
raise
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
51
71
|
def initialize(raw, **options)
|
52
72
|
@options = { logger: Logger.new(nil), severity: Logger::WARN, **options }
|
53
|
-
|
54
|
-
@raw =
|
55
|
-
case raw
|
56
|
-
when String
|
57
|
-
JSON.parse(gsub(raw), symbolize_names: true)
|
58
|
-
when Hash
|
59
|
-
raw
|
60
|
-
else
|
61
|
-
raise
|
62
|
-
end
|
73
|
+
@raw = symbolize(make_hash(raw))
|
63
74
|
end
|
64
75
|
|
65
76
|
def to_hash
|
data/lib/crate/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: data_crate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Minwoo Lee
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-11-
|
11
|
+
date: 2017-11-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|