dorian-to_struct 0.6.0 → 1.0.0

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.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/bin/to_struct +12 -0
  3. data/lib/dorian/to_struct.rb +2 -10
  4. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1df7e372e064769577c0f935aba5a031c018cd20773d0179fd235d6389f42b03
4
- data.tar.gz: a36461a79045aadc2d2db55cd8ddf865fee2084e6394a40638622397b6c6140b
3
+ metadata.gz: 2e94fed03af12d2dde58f30d58269be8660b31c6d34676c12e578171e55046a8
4
+ data.tar.gz: 8623cad9f317985b9e89a18ddc16d0764cb39eb0f6d4d6d100fa84eadfd0cddf
5
5
  SHA512:
6
- metadata.gz: 3b2f021e76fc46741709ab82571d463edbfd3d5450dbe605e60641845419fd696f1a077e1b877ae2a6c54e34786bda3a2de58316db5c05cb1cdde87d06f4f444
7
- data.tar.gz: 066f280876341a13d489a0f5ecc66115702c7197c8eb920091bb96f76768c8d319bcc3b500696b0899fe0953ec7feaed37de45cc7a9d9be3a8464cf5fbc72d38
6
+ metadata.gz: e5c11c0f204b936a5424a1567245fb005679a3582e353fbaf4a05cf92129b930150e89f6352db8d0bb00ff28f66deb6461e908665bb5b8095921ea9e5ce337fe
7
+ data.tar.gz: d8823c92d7278b39a06829aacad8f51d90310da4e23fa0f577cef225c04028774f1e5e93c9f97e708f999ade06adb86c62044e32f9c3070b8b99f0894cdf6665
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
@@ -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.6.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Marié
@@ -12,10 +12,12 @@ 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
+ - bin/to_struct
19
21
  - lib/dorian-to_struct.rb
20
22
  - lib/dorian/to_struct.rb
21
23
  homepage: https://github.com/dorianmariecom/dorian-to_struct