lite-ruby 1.0.25 → 1.0.26

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4d01bb77cf20881775c7cecdee1ba3eeda550694a37dd5431e1efbca7b4a49b
4
- data.tar.gz: e4f77ca66978020ab63fc01749946bfd027a5ddb04dabbd97dd1baaffed73d16
3
+ metadata.gz: a60b6620f1f96b3e70290ffef9a747511107a86449742e1be095be4aa0ffea91
4
+ data.tar.gz: 23e7fdc0cf9e7948812d95b4f36528eb264d7e041f7986d86cf1ebff770d70a0
5
5
  SHA512:
6
- metadata.gz: 90d2b0f6662767b3650ed5b7230d45e17ccced7d63306998cc4b513ae632b1a9fb59b56c4543cfb16f64501e0a7da49bb7805cb57dc153619d32d511dde35796
7
- data.tar.gz: a176f671ca037bb02bfc010f4e6284341f0586a30e038698c9f447a464bd850b2361f09c7a2948eeac426398d290f7451afa5cb54b979eacc429dd826e3b65dc
6
+ metadata.gz: 883d36b8714d876f6a5f31da52da55c1da86641033724c94e2e0045e261e6e2427a4f1cb3f2d9bda234d564018f97f4c21efa55e8d9276826cead809d6c7f949
7
+ data.tar.gz: a457a5207c0e203689ad0064232032b7419e13c9297e1ad7365ea8f5c0f699736eb5b9851a94c475262b21ab8429ae2772240e8d8f7046b6113ba53b61889d2c
@@ -18,6 +18,8 @@ Layout/LineLength:
18
18
  Max: 100
19
19
  Layout/SpaceAroundMethodCallOperator:
20
20
  Enabled: true
21
+ Lint/DeprecatedOpenSSLConstant:
22
+ Enabled: true
21
23
  Lint/RaiseException:
22
24
  Enabled: true
23
25
  Lint/StructNewOverride:
@@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [1.0.26] - 2020-05-22
10
+ ### Changed
11
+ - Changed hash `to_open_struct` and `to_object` to be independent methods
12
+
9
13
  ## [1.0.25] - 2020-05-20
10
14
  ### Added
11
15
  - Added Hash => `to_open_struct`
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lite-ruby (1.0.25)
4
+ lite-ruby (1.0.26)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -81,14 +81,17 @@ GEM
81
81
  diff-lcs (>= 1.2.0, < 2.0)
82
82
  rspec-support (~> 3.9.0)
83
83
  rspec-support (3.9.3)
84
- rubocop (0.83.0)
84
+ rubocop (0.84.0)
85
85
  parallel (~> 1.10)
86
86
  parser (>= 2.7.0.1)
87
87
  rainbow (>= 2.2.2, < 4.0)
88
88
  rexml
89
+ rubocop-ast (>= 0.0.3)
89
90
  ruby-progressbar (~> 1.7)
90
91
  unicode-display_width (>= 1.4.0, < 2.0)
91
- rubocop-performance (1.5.2)
92
+ rubocop-ast (0.0.3)
93
+ parser (>= 2.7.0.1)
94
+ rubocop-performance (1.6.0)
92
95
  rubocop (>= 0.71.0)
93
96
  rubocop-rspec (1.39.0)
94
97
  rubocop (>= 0.68.1)
@@ -425,12 +425,22 @@ Symbolize and underscore hash keys.
425
425
  { 'firstName' => 'foo', 'last Name' => 'test' }.symbolize_and_underscore_keys #=> { first_name: 'foo', last_name: 'test' }
426
426
  ```
427
427
 
428
- `to_open_struct` aka `to_object` aka `to_o`
428
+ `to_object` aka `to_o`
429
+ ------
430
+ Converts a hash and all nested hashes to open structs.
431
+
432
+ ```ruby
433
+ { foo: { bar: true } }.to_object.foo.bar #=> true
434
+ { foo: { bar: true } }.to_object.foo.bax #=> nil
435
+ ```
436
+
437
+ `to_open_struct`
429
438
  ------
430
439
  Converts a hash to an open struct to have an object like API.
431
440
 
432
441
  ```ruby
433
- { foo: { bar: true } }.to_open_struct.foo.bar #=> true
442
+ { foo: { bar: true } }.to_open_struct.foo #=> { bar: true }
443
+ { foo: { bar: true } }.to_open_struct.bax #=> nil
434
444
  ```
435
445
 
436
446
  `to_struct`
@@ -439,6 +449,7 @@ Converts a hash to a struct to have an object like API.
439
449
 
440
450
  ```ruby
441
451
  { foo: { bar: true } }.to_struct.foo #=> { bar: true }
452
+ { foo: { bar: true } }.to_struct.bax #=> Raises error
442
453
  ```
443
454
 
444
455
  `update_each`
@@ -440,12 +440,17 @@ if Lite::Ruby.configuration.monkey_patches.include?('hash')
440
440
  replace(symbolize_and_underscore_keys)
441
441
  end
442
442
 
443
- def to_open_struct
443
+ def to_object
444
444
  JSON.parse(to_json, object_class: OpenStruct)
445
445
  end
446
446
 
447
- alias to_object to_open_struct
448
- alias to_o to_open_struct
447
+ alias to_o to_object
448
+
449
+ def to_open_struct(lazy: true)
450
+ struct = OpenStruct.new(self)
451
+ struct.methods(lazy)
452
+ struct
453
+ end
449
454
 
450
455
  def to_struct
451
456
  struct = Struct.new(*keys)
@@ -3,7 +3,7 @@
3
3
  module Lite
4
4
  module Ruby
5
5
 
6
- VERSION ||= '1.0.25'
6
+ VERSION ||= '1.0.26'
7
7
 
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lite-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.25
4
+ version: 1.0.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Juan Gomez
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-05-20 00:00:00.000000000 Z
11
+ date: 2020-05-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler