service_pattern 1.0.7 → 1.0.8

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: d7ec1a1bdbbf5c1579ff34c0acdf54220b88ce43e845a4dcbc99ab930f8a6f49
4
- data.tar.gz: fb09e4e6237d5eb07f028fab2968bbe178775b4b1fdae3d34a23550139b2c7cb
3
+ metadata.gz: 63c1dea6c5ce4fe51b3e76f3d00d5ca1ae0ffe1606bd25e5bcb4015aa88b56bf
4
+ data.tar.gz: 99fcc5fe4cda47aab13599331717ea8c3f1781aa9889a2d1e208257de5c8cb16
5
5
  SHA512:
6
- metadata.gz: 8410e3bbde7f41d0f66ac4d7e4acc347901259ae4bd4817cdf66f1b872380915b3579359579ce2c137e14436d0d96e0b65360569003488ea4a9455b76513e447
7
- data.tar.gz: 9802cae2a1eca34b23962af137890f226dfb274d2bd219d5aaf8d23fd6c9225423406525acd7720c94e6332a4ca101dfc75257781a6399db310865a95ee1e1df
6
+ metadata.gz: b427f1b1346a9cf648a0366e0882c15244422b02e6cbeea637f23965ad74116f18427bf9df5c71c85e1f90aba61265925874d044bdd6b451d14cb44fc1e16bd7
7
+ data.tar.gz: ff393b3a73bb1951de6936005a95e47b248aecaf7ad1c96d3333bfc0d27eb422dc98c368b233e25f07e4846b49f824400331b5585ab0e77e21c1b9b1dffc56a5
@@ -63,7 +63,13 @@ class ServicePattern::Service
63
63
  def initialize(**args)
64
64
  arguments = self.class.instance_variable_get(:@arguments)
65
65
  arguments&.each do |argument_name, argument_options|
66
- raise ArgumentError, "missing keyword: #{argument_name}" if !args.key?(argument_name) && !argument_options.key?(:default)
66
+ next if args.key?(argument_name)
67
+
68
+ if argument_options.key?(:default)
69
+ __send__("#{argument_name}=", argument_options.fetch(:default))
70
+ else
71
+ raise ArgumentError, "missing keyword: #{argument_name}"
72
+ end
67
73
  end
68
74
 
69
75
  args.each do |key, value|
@@ -1,3 +1,3 @@
1
1
  module ServicePattern
2
- VERSION = "1.0.7".freeze
2
+ VERSION = "1.0.8".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: service_pattern
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - kaspernj
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-23 00:00:00.000000000 Z
11
+ date: 2022-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: appraisal