dorian-to_struct 0.1.1 → 0.1.2

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: 624e890dfaf281f02251890dc9d70b9c9995f44e8b4dd01d76d070b213c2dfb3
4
- data.tar.gz: 72d675fab871640830082d7fc80b915365b7ea0c8ed834683fcb5a0c5ef6eeb2
3
+ metadata.gz: 49bd0ba3de934523a001e901d7337f9de71b7af79d1ad4f27d9fa708c412a516
4
+ data.tar.gz: 2980eee293f67aff8b1fa406ad12c79ee276d16c3b7d5388f76e45c46d5540d1
5
5
  SHA512:
6
- metadata.gz: 6e0a4367dee39a7a61fb2b9efe657e75c655e582b56f60da78557d56015621dfcfd61cf149ba2f42b2c8d10f749c7d6f28841755731c16542d97227a740fdc71
7
- data.tar.gz: 4251fbd5372c399c159f5aba82a24ad2de81897424f1655b28c4aefd577426f7717828051ce09a9fc3d227acbc4e121b586d1ebd1ff5bffd60d9f5cfa7a89ffe
6
+ metadata.gz: 06f3cdacb5b1b7831d3e7ebcb04027631750e7b29566cd01489143880d1b9978118a3bdb030417581afb53187b99330a6beeee7c401d1deb8c22d1c4c7c4df5c
7
+ data.tar.gz: f1f29b0affd933fe06733bfdff354782a59a94dba9d81cabb03832109cc3b0a82046502e5423dbf23005119dfe72896b4f7615a89994d954937edfae9e97fd30
@@ -8,7 +8,7 @@ class Hash
8
8
  # user.birthdate # => NoMethodError: undefined method `birthdate' for <struct...>
9
9
  #
10
10
  def to_struct
11
- Struct.new(*keys).new(*values)
11
+ Struct.new(*keys.map(&:to_sym)).new(*values)
12
12
  end
13
13
 
14
14
  # Returns a new struct with the same key/value pairs
@@ -18,7 +18,7 @@ class Hash
18
18
  #
19
19
  def to_deep_struct
20
20
  Struct
21
- .new(*keys)
21
+ .new(*keys.map(&:to_sym))
22
22
  .new(
23
23
  *values.map do |value|
24
24
  value.respond_to?(:to_deep_struct) ? value.to_deep_struct : value
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.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dorian Marié