resource-struct 0.3.3 → 0.4.0

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: 7dae7c6c56053d571217150d28f4f70dc6c8c28524d360460e328d09034c17ea
4
- data.tar.gz: 85a4dc5b15dcb2af42f30ad4e9daa66e3e16b727934305c46e06536a23e6a90c
3
+ metadata.gz: 81f9dfcc67f4c1670776860dd53c7d0885eb1b1d53ca7b9bae7202c782cbad85
4
+ data.tar.gz: ae36515a1e79be8653e2b4497dee9ab5f8d522e740cfcafe93681d946a5e528e
5
5
  SHA512:
6
- metadata.gz: 781fab03b76d80ba0169635168f46e5cefef893ea7f9dd0a15d5dbed1c9dc211b7ebfef024288f2335a1d3dd50bd920b056b22f7e23d0d2ebddae0178b32b6f6
7
- data.tar.gz: 64b857102c619e60462d4919021735162c2c991e4bb65ad5096576af4620f866c15b91dbff3062cc1494aa1c94c05d4e29fbe9ad5745f895468e8d0ed80a232a
6
+ metadata.gz: 835d23cd09aa4a26cce6cf30378e749f5eee0a9439501fd1120ee3ac6f77f6adaed05ea688632e23dce09dd7bee8616859176fbc135b2d027c388aa3eec10e1b
7
+ data.tar.gz: 102bada15cf4151340c2fd95c5927335e19ec9bd637a2e74ba3b1e2193ead54a3a3a5af8d451caf364f0465caf5663079eeeaf72e3b7c7acc7b1ef7c847e3f95
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.4.0] - 2022-01-09
4
+ ### Feature
5
+ - Better support for `ArgumentError` on `FlexStruct`
6
+
3
7
  ## [0.3.3] - 2022-01-05
4
8
  ### Fix
5
9
  - Support false values correctly, instead of returning nil
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- resource-struct (0.3.3)
4
+ resource-struct (0.4.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -37,12 +37,17 @@ module ResourceStruct
37
37
  end
38
38
 
39
39
  def method_missing(name, *args)
40
- args_length = args.length
41
- return self[name] if ___key?(name) && args_length.zero?
42
- return !!self[name[...-1]] if name.end_with?("?") && args_length.zero?
43
- return self[name[...-1]] = args.first if name.end_with?("=") && args_length == 1
40
+ if name.end_with?("=")
41
+ return self[name[...-1]] = args.first if args.length == 1
44
42
 
45
- nil
43
+ raise ArgumentError, "expected 1 argument received #{args.length} arguments"
44
+ elsif name.end_with?("?")
45
+ return !!self[name[...-1]] if args.empty?
46
+ elsif args.empty?
47
+ return self[name]
48
+ end
49
+
50
+ raise ArgumentError, "expected 0 arguments received #{args.length} arguments"
46
51
  end
47
52
 
48
53
  def respond_to_missing?(name, include_private = false)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ResourceStruct
4
- VERSION = "0.3.3"
4
+ VERSION = "0.4.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: resource-struct
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Riedler
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-05 00:00:00.000000000 Z
11
+ date: 2022-01-10 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Openstruct like access without all the headaches of Hash method overrides
14
14
  etc...
@@ -41,7 +41,7 @@ metadata:
41
41
  homepage_uri: https://github.com/AlexRiedler/resource-struct
42
42
  source_code_uri: https://github.com/AlexRiedler/resource-struct
43
43
  changelog_uri: https://raw.githubusercontent.com/AlexRiedler/resource-struct/master/CHANGELOG.md
44
- post_install_message:
44
+ post_install_message:
45
45
  rdoc_options: []
46
46
  require_paths:
47
47
  - lib
@@ -56,8 +56,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
56
56
  - !ruby/object:Gem::Version
57
57
  version: '0'
58
58
  requirements: []
59
- rubygems_version: 3.0.3
60
- signing_key:
59
+ rubygems_version: 3.1.6
60
+ signing_key:
61
61
  specification_version: 4
62
62
  summary: Ruby structs for resource responses
63
63
  test_files: []