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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1df7e372e064769577c0f935aba5a031c018cd20773d0179fd235d6389f42b03
4
- data.tar.gz: a36461a79045aadc2d2db55cd8ddf865fee2084e6394a40638622397b6c6140b
3
+ metadata.gz: 350eb6877cc6add5b4ac355d0863bc64d7dd1f22311e61df9d5dc94686ac82db
4
+ data.tar.gz: b201457ccb571fcccf5c131cf0bd454eeb35cc52a3a600edde79dbc4cb8803f6
5
5
  SHA512:
6
- metadata.gz: 3b2f021e76fc46741709ab82571d463edbfd3d5450dbe605e60641845419fd696f1a077e1b877ae2a6c54e34786bda3a2de58316db5c05cb1cdde87d06f4f444
7
- data.tar.gz: 066f280876341a13d489a0f5ecc66115702c7197c8eb920091bb96f76768c8d319bcc3b500696b0899fe0953ec7feaed37de45cc7a9d9be3a8464cf5fbc72d38
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
@@ -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.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