dorian-to_struct 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -0
  3. data/lib/dorian/to_struct.rb +26 -0
  4. metadata +2 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2e94fed03af12d2dde58f30d58269be8660b31c6d34676c12e578171e55046a8
4
- data.tar.gz: 8623cad9f317985b9e89a18ddc16d0764cb39eb0f6d4d6d100fa84eadfd0cddf
3
+ metadata.gz: d4f5ac19e990aa8f6bf562b7d81cdc16883fe2125f3ca3c49ed5c263fe9ea093
4
+ data.tar.gz: cca57932c680abb611f8607b04cc7c91c95afdb47ed32a13e3758336b6bebf31
5
5
  SHA512:
6
- metadata.gz: e5c11c0f204b936a5424a1567245fb005679a3582e353fbaf4a05cf92129b930150e89f6352db8d0bb00ff28f66deb6461e908665bb5b8095921ea9e5ce337fe
7
- data.tar.gz: d8823c92d7278b39a06829aacad8f51d90310da4e23fa0f577cef225c04028774f1e5e93c9f97e708f999ade06adb86c62044e32f9c3070b8b99f0894cdf6665
6
+ metadata.gz: 26b356e92e535b244016df40bb9dc40063797799d0f915bbaaa0e1411d647552dc1ed8ab3081479fbb0ab5e95c138a4a59dd5ef586096ab18630aa05ed0ad782
7
+ data.tar.gz: 87d48e7153fa3343038347bce0a17420d3ab95cf60f9b9ec77f12527cac1322da106b986a640f2c0129336132ae82bfdd31ef435f2b365c681c0084ff8e5a42d
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.1.0
@@ -3,9 +3,27 @@ class Array
3
3
  map(&:to_struct)
4
4
  end
5
5
 
6
+ def from_struct
7
+ map(&:from_struct)
8
+ end
9
+
6
10
  def to_deep_struct
7
11
  map(&:to_deep_struct)
8
12
  end
13
+
14
+ def from_deep_struct
15
+ map(&:from_deep_struct)
16
+ end
17
+ end
18
+
19
+ class Struct
20
+ def from_struct
21
+ to_h
22
+ end
23
+
24
+ def from_deep_struct
25
+ to_h { |key, value| [key, value.from_deep_struct] }
26
+ end
9
27
  end
10
28
 
11
29
  class Hash
@@ -26,4 +44,12 @@ class Object
26
44
  def to_deep_struct
27
45
  self
28
46
  end
47
+
48
+ def from_struct
49
+ self
50
+ end
51
+
52
+ def from_deep_struct
53
+ self
54
+ end
29
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dorian-to_struct
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Marié
@@ -17,6 +17,7 @@ executables:
17
17
  extensions: []
18
18
  extra_rdoc_files: []
19
19
  files:
20
+ - VERSION
20
21
  - bin/to_struct
21
22
  - lib/dorian-to_struct.rb
22
23
  - lib/dorian/to_struct.rb