dorian-to_struct 1.0.1 → 1.2.0

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
  SHA256:
3
- metadata.gz: 350eb6877cc6add5b4ac355d0863bc64d7dd1f22311e61df9d5dc94686ac82db
4
- data.tar.gz: b201457ccb571fcccf5c131cf0bd454eeb35cc52a3a600edde79dbc4cb8803f6
3
+ metadata.gz: f0ae4bed7c94afb36d93d5478f6428cc89e67fab14bb9d58f7f6ba034f47b4e8
4
+ data.tar.gz: 94e2630ddab6f77cf0934522662cd607fee2e13f10b52949e1abf4e2a652dfc4
5
5
  SHA512:
6
- metadata.gz: 7bb8b46c1de9064a90d801d84ef3cc8e9911738ab8a483b5442fbba93246acb68a3ea0684fede2569a512a11a61e9aac9c005b1b9619356f1ede0f603fd8c957
7
- data.tar.gz: bdc61f968f6d2523aae3092368363a687082e75f6a94074248079e28b32c407b88171c72aa9eaee2694d685f0d10067b81f7c1b760fb8a893db72dbdc6e1e7cf
6
+ metadata.gz: ec769c18b18cd03c739f19d5c7f2d39dc74f931cb030b1376c200b53443e5e3095748588f82b3a8c204f99fdcb84757adc6bb2ac9e8b13bac2d68ab83e13f67a
7
+ data.tar.gz: 9b25d6baae4fde65f1e038fea5b07220813f628186d4e0719cd4b87639c4cd057b4238cf815e0fcdc5df837e371c67483277260e81428ddbc23f58428c938ab8
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.2.0
data/bin/to_struct CHANGED
@@ -6,7 +6,7 @@ require "dorian/arguments"
6
6
  parsed = Dorian::Arguments.parse(version: { alias: :v }, help: { alias: :h })
7
7
 
8
8
  if parsed.options.version
9
- abort File.read(File.expand_path("../../VERSION", __FILE__))
9
+ abort File.read(File.expand_path("../VERSION", __dir__))
10
10
  else
11
11
  abort parsed.help
12
12
  end
@@ -1,11 +1,31 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class Array
2
4
  def to_struct
3
5
  map(&:to_struct)
4
6
  end
5
7
 
8
+ def from_struct
9
+ map(&:from_struct)
10
+ end
11
+
6
12
  def to_deep_struct
7
13
  map(&:to_deep_struct)
8
14
  end
15
+
16
+ def from_deep_struct
17
+ map(&:from_deep_struct)
18
+ end
19
+ end
20
+
21
+ class Struct
22
+ def from_struct
23
+ to_h
24
+ end
25
+
26
+ def from_deep_struct
27
+ to_h.transform_values(&:from_deep_struct)
28
+ end
9
29
  end
10
30
 
11
31
  class Hash
@@ -26,4 +46,12 @@ class Object
26
46
  def to_deep_struct
27
47
  self
28
48
  end
49
+
50
+ def from_struct
51
+ self
52
+ end
53
+
54
+ def from_deep_struct
55
+ self
56
+ end
29
57
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dorian-to_struct
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Marié
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-08-24 00:00:00.000000000 Z
11
+ date: 2024-08-29 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: makes structs
14
14
  email: dorian@dorianmarie.com
@@ -32,9 +32,9 @@ require_paths:
32
32
  - lib
33
33
  required_ruby_version: !ruby/object:Gem::Requirement
34
34
  requirements:
35
- - - ">="
35
+ - - '='
36
36
  - !ruby/object:Gem::Version
37
- version: '0'
37
+ version: 3.3.4
38
38
  required_rubygems_version: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - ">="