dorian-to_struct 0.6.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -0
- data/bin/to_struct +12 -0
- data/lib/dorian/to_struct.rb +2 -10
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 350eb6877cc6add5b4ac355d0863bc64d7dd1f22311e61df9d5dc94686ac82db
|
4
|
+
data.tar.gz: b201457ccb571fcccf5c131cf0bd454eeb35cc52a3a600edde79dbc4cb8803f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bb8b46c1de9064a90d801d84ef3cc8e9911738ab8a483b5442fbba93246acb68a3ea0684fede2569a512a11a61e9aac9c005b1b9619356f1ede0f603fd8c957
|
7
|
+
data.tar.gz: bdc61f968f6d2523aae3092368363a687082e75f6a94074248079e28b32c407b88171c72aa9eaee2694d685f0d10067b81f7c1b760fb8a893db72dbdc6e1e7cf
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.0.1
|
data/bin/to_struct
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "dorian/arguments"
|
5
|
+
|
6
|
+
parsed = Dorian::Arguments.parse(version: { alias: :v }, help: { alias: :h })
|
7
|
+
|
8
|
+
if parsed.options.version
|
9
|
+
abort File.read(File.expand_path("../../VERSION", __FILE__))
|
10
|
+
else
|
11
|
+
abort parsed.help
|
12
|
+
end
|
data/lib/dorian/to_struct.rb
CHANGED
@@ -10,19 +10,11 @@ end
|
|
10
10
|
|
11
11
|
class Hash
|
12
12
|
def to_struct
|
13
|
-
Struct.new(
|
14
|
-
*keys.map(&:to_sym)
|
15
|
-
).new(
|
16
|
-
*values
|
17
|
-
)
|
13
|
+
Struct.new(*keys.map(&:to_sym)).new(*values)
|
18
14
|
end
|
19
15
|
|
20
16
|
def to_deep_struct
|
21
|
-
Struct.new(
|
22
|
-
*keys.map(&:to_sym)
|
23
|
-
).new(
|
24
|
-
*values.map(&:to_deep_struct)
|
25
|
-
)
|
17
|
+
Struct.new(*keys.map(&:to_sym)).new(*values.map(&:to_deep_struct))
|
26
18
|
end
|
27
19
|
end
|
28
20
|
|
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: 0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dorian Marié
|
@@ -12,10 +12,13 @@ date: 2024-08-24 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
13
13
|
description: makes structs
|
14
14
|
email: dorian@dorianmarie.com
|
15
|
-
executables:
|
15
|
+
executables:
|
16
|
+
- to_struct
|
16
17
|
extensions: []
|
17
18
|
extra_rdoc_files: []
|
18
19
|
files:
|
20
|
+
- VERSION
|
21
|
+
- bin/to_struct
|
19
22
|
- lib/dorian-to_struct.rb
|
20
23
|
- lib/dorian/to_struct.rb
|
21
24
|
homepage: https://github.com/dorianmariecom/dorian-to_struct
|