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 CHANGED
@@ -12,7 +12,7 @@ module JStruct
12
12
  end
13
13
 
14
14
  require 'jstruct/jclass'
15
- require 'jstruct/ext/array'
15
+ require 'jstruct/ext/enumerable'
16
16
  require 'jstruct/ext/hash'
17
17
  require 'jstruct/ext/integer'
18
18
  require 'jstruct/ext/object'
@@ -1,4 +1,4 @@
1
- class Array
1
+ module Enumerable
2
2
  def to_jexp
3
3
  map {|o| o.to_jexp }
4
4
  end
@@ -7,10 +7,10 @@ module JStruct
7
7
 
8
8
  def self.from(data)
9
9
  case data
10
- when String then from(JSON.parse(data))
11
- when Array then data.map {|o| from(o) }
12
- when Hash then from_hash(data)
13
- when NilClass then nil
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
@@ -1,3 +1,3 @@
1
1
  module JStruct
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
  end
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: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
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/array.rb
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