smart_initializer 0.6.0 → 0.7.0
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 +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +2 -2
- data/README.md +2 -0
- data/lib/smart_core/initializer/configuration.rb +5 -0
- data/lib/smart_core/initializer/constructor.rb +2 -1
- data/lib/smart_core/initializer/version.rb +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 84aa6ce59c1c73432c01015a595c6a20c2e11344d2d6464aa63920c288f3b51f
|
4
|
+
data.tar.gz: '0819287ddbd9cfc21fac709a848205230036dd2b724df4568ed90b36bbd0316e'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
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
|
|
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.
|
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-
|
11
|
+
date: 2021-06-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: smart_engine
|