jstruct 0.1.0 → 0.1.1
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.
- data/lib/jstruct.rb +1 -1
- data/lib/jstruct/ext/{array.rb → enumerable.rb} +1 -1
- data/lib/jstruct/jclass.rb +4 -4
- data/lib/jstruct/version.rb +1 -1
- metadata +4 -4
data/lib/jstruct.rb
CHANGED
data/lib/jstruct/jclass.rb
CHANGED
@@ -7,10 +7,10 @@ module JStruct
|
|
7
7
|
|
8
8
|
def self.from(data)
|
9
9
|
case data
|
10
|
-
when String
|
11
|
-
when
|
12
|
-
when
|
13
|
-
when NilClass
|
10
|
+
when String then from(JSON.parse(data))
|
11
|
+
when Hash then from_hash(data)
|
12
|
+
when Enumerable then data.map {|o| from(o) }
|
13
|
+
when NilClass then nil
|
14
14
|
else raise("Can't parse a #{data.class} into a #{self}")
|
15
15
|
end
|
16
16
|
end
|
data/lib/jstruct/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jstruct
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ben Burkert
|
@@ -70,7 +70,7 @@ extensions: []
|
|
70
70
|
extra_rdoc_files: []
|
71
71
|
|
72
72
|
files:
|
73
|
-
- ./lib/jstruct/ext/
|
73
|
+
- ./lib/jstruct/ext/enumerable.rb
|
74
74
|
- ./lib/jstruct/ext/hash.rb
|
75
75
|
- ./lib/jstruct/ext/integer.rb
|
76
76
|
- ./lib/jstruct/ext/numeric.rb
|