json_kit 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1eb7bfab970bf56419955844c3ead0c669363d3f
4
- data.tar.gz: e273afa5f546b1acb4439cb058e44d19f573024d
3
+ metadata.gz: 124a907f6ecc526f395bdffdd4886b288e4e0de3
4
+ data.tar.gz: 397d84b0cb92cfcd0ac0218674ea83f5978a3b39
5
5
  SHA512:
6
- metadata.gz: 6afb857d8143d202a38b87a4dc0b5ff6558eac582224292e6f1402b6c250cfe9c7e4b1d230488294a9a0b05d685b137febd9d9b770161e510f546cdddc8a845e
7
- data.tar.gz: 5ed3931cac094cf2151256a28c692c0c8867cfbdcb08370757c1d6ccb5a0395fe3d516f683a2cab9dcd96c17ebd2a7ad280d869a966288ee9a8be87fd951a6e6
6
+ metadata.gz: af2fa1a9d918ab25793e21bad803e33ab2e435cea7e6574ff88d104b15fb0c167bb11c5f543d0b62fb7e3cf739c762ac1c0e14a87c26f0e9d0fdceb7078a9a93
7
+ data.tar.gz: 7d62cb449737ce8c13f957ebbbef4483677d00c35f79a919c170577d628f22538a39a8c09c03c1b85d277ef8f4a577ddebccf21abd435c69569794e4bd1a35f6
@@ -18,12 +18,26 @@ module JsonKit
18
18
 
19
19
  def from_json(json, klass = nil, transforms = [])
20
20
 
21
- hash = JSON.load(json)
21
+ obj = JSON.parse(json)
22
22
 
23
- if klass != nil
24
- return @hash_helper.from_hash(hash, klass, transforms)
23
+ if [String, Fixnum, Numeric, Date, DateTime, Time, Integer].include?(obj.class)
24
+ return json
25
+ end
26
+
27
+ if obj.is_a?(Array)
28
+ return obj.map do |i|
29
+ if klass != nil
30
+ @hash_helper.from_hash(i, klass, transforms)
31
+ else
32
+ @hash_helper.symbolize(i)
33
+ end
34
+ end
25
35
  else
26
- return @hash_helper.symbolize(hash)
36
+ if klass != nil
37
+ return @hash_helper.from_hash(obj, klass, transforms)
38
+ else
39
+ return @hash_helper.symbolize(obj)
40
+ end
27
41
  end
28
42
 
29
43
  end
@@ -1,3 +1,3 @@
1
1
  module JsonKit
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: json_kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - vaughanbrittonsage