smart_initializer 0.6.0 → 0.7.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: 7fe42fb05f82247b924687f18a3eb129d7a49d0e9b071c801adc828c64ae4f93
4
- data.tar.gz: 3dc7371d09e41172337c2bd98db4b06239f77c624cedcdbf8848503eba946de2
3
+ metadata.gz: 84aa6ce59c1c73432c01015a595c6a20c2e11344d2d6464aa63920c288f3b51f
4
+ data.tar.gz: '0819287ddbd9cfc21fac709a848205230036dd2b724df4568ed90b36bbd0316e'
5
5
  SHA512:
6
- metadata.gz: a76205061e305e24474db7a08c045a9889ca8859d1658fa9df1fca20a94edea83574c5b62bb81daeefa21ba3c5ec70d9cb03b55b1f2910383bbde1735547677b
7
- data.tar.gz: 3bafdce939b39dd8418dc1baeafecc199b6460b98e25e3eba5c5732f22c62d58df1c29383c31a668edd79782c8c29a18c9359f7ef080b0a4d6716b1dec457207
6
+ metadata.gz: e6b1f6664ae3e519b4fe516e565b959987f459d145d0f5de4a7d26e8b9d32ed103567eb11d7d050ef1b3d7ad2fa05e430223060f7638552dfe24edd3d8999644
7
+ data.tar.gz: 7ee572ea83d433095f1fd3a27a127543eb22fbbafde515e052e6d1a3360914c828a8dd983f8659501a7fbca08499cec11a34a18e4c43ac9702acd39af5235663
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
1
  # Changelog
2
2
  All notable changes to this project will be documented in this file.
3
3
 
4
+ ## [0.7.0] - 2021-06-23
5
+ ## Added
6
+ - `strict_options` config option for non-strict checking of passed options;
7
+
4
8
  ## [0.6.0] - 2021-06-23
5
9
  ## Added
6
10
  - Validation messages for incorrect attribute types;
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- smart_initializer (0.6.0)
4
+ smart_initializer (0.6.1)
5
5
  qonfig (~> 0.24)
6
6
  smart_engine (~> 0.11)
7
7
  smart_types (~> 0.4)
@@ -107,4 +107,4 @@ DEPENDENCIES
107
107
  smart_initializer!
108
108
 
109
109
  BUNDLED WITH
110
- 2.2.11
110
+ 2.2.19
data/README.md CHANGED
@@ -156,11 +156,13 @@ user.__attributes__ # => { first_name: 'Rustam', second_name: 'Ibragimov', age:
156
156
  - you can read config values via `[]` or `.config.settings` or `.config[key]`;
157
157
  - setitngs:
158
158
  - `default_type_system` - default type system (`smart_types` by default);
159
+ - `strict_options` - raise an error when got unknown options if true (`true` by default);
159
160
 
160
161
  ```ruby
161
162
  # configure:
162
163
  SmartCore::Initializer::Configuration.configure do |config|
163
164
  config.default_type_system = :smart_types # default setting value
165
+ config.strict_options = true # default setting value
164
166
  end
165
167
  ```
166
168
 
@@ -29,5 +29,10 @@ module SmartCore::Initializer::Configuration
29
29
  validate :default_type_system do |value|
30
30
  SmartCore::Initializer::TypeSystem.resolve(value) rescue false
31
31
  end
32
+
33
+ setting :strict_options, true
34
+ validate :strict_options do |value|
35
+ !!value == value # check if it's a boolean value
36
+ end
32
37
  end
33
38
  end
@@ -72,6 +72,7 @@ class SmartCore::Initializer::Constructor
72
72
  #
73
73
  # @api private
74
74
  # @since 0.1.0
75
+ # @version 0.7.0
75
76
  # rubocop:disable Metrics/AbcSize
76
77
  def prevent_attribute_insufficiency
77
78
  required_parameter_count = klass.__params__.size
@@ -96,7 +97,7 @@ class SmartCore::Initializer::Constructor
96
97
  raise(
97
98
  SmartCore::Initializer::OptionArgumentError,
98
99
  "Unknown options: #{unknown_options.join(', ')}"
99
- ) if unknown_options.any?
100
+ ) if unknown_options.any? && SmartCore::Initializer::Configuration[:strict_options]
100
101
  end
101
102
  # rubocop:enable Metrics/AbcSize
102
103
 
@@ -6,7 +6,7 @@ module SmartCore
6
6
  #
7
7
  # @api public
8
8
  # @since 0.1.0
9
- # @version 0.6.0
10
- VERSION = '0.6.0'
9
+ # @version 0.7.0
10
+ VERSION = '0.7.0'
11
11
  end
12
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smart_initializer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rustam Ibragimov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-23 00:00:00.000000000 Z
11
+ date: 2021-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: smart_engine