smart_initializer 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +6 -8
- data/README.md +2 -1
- data/gemfiles/with_external_deps.gemfile.lock +1 -1
- data/gemfiles/without_external_deps.gemfile.lock +1 -1
- data/lib/smart_core/initializer/constructor.rb +12 -2
- data/lib/smart_core/initializer/version.rb +1 -1
- data/smart_initializer.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9bd642b208f012f92391fa7564b1726eced30ef64ed7bcd31a1a7a2c5ef1c5fc
|
4
|
+
data.tar.gz: c1645e91c921429d8dd4314c730bd28c7be981f21f0a90fcee224c267e410fb4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65b8419d5b08f2fd53044963cf0451f903d4b69a030f6ccb38a462e3055d22d6e1ed416ca7872d195b569d15cc0acc5cb087b91af6180a42305eb1e656afaded
|
7
|
+
data.tar.gz: cdf0ef362116f807c603384008c9a829220879a9e27b1120d6de673779092740c12d906c0dd4923a4c4429f7ee7aac6418f248388b02d7d3a293cf9737403bbf
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
smart_initializer (0.
|
4
|
+
smart_initializer (0.2.0)
|
5
5
|
qonfig (~> 0.24)
|
6
6
|
smart_engine (~> 0.6)
|
7
7
|
smart_types (~> 0.1.0)
|
@@ -15,8 +15,8 @@ GEM
|
|
15
15
|
minitest (~> 5.1)
|
16
16
|
tzinfo (~> 1.1)
|
17
17
|
zeitwerk (~> 2.2, >= 2.2.2)
|
18
|
-
armitage-rubocop (0.
|
19
|
-
rubocop (= 0.
|
18
|
+
armitage-rubocop (0.83.0)
|
19
|
+
rubocop (= 0.83.0)
|
20
20
|
rubocop-performance (= 1.5.2)
|
21
21
|
rubocop-rails (= 2.5.2)
|
22
22
|
rubocop-rake (= 0.5.1)
|
@@ -27,8 +27,7 @@ GEM
|
|
27
27
|
docile (1.3.2)
|
28
28
|
i18n (1.8.2)
|
29
29
|
concurrent-ruby (~> 1.0)
|
30
|
-
|
31
|
-
minitest (5.14.0)
|
30
|
+
minitest (5.14.1)
|
32
31
|
parallel (1.19.1)
|
33
32
|
parser (2.7.1.2)
|
34
33
|
ast (~> 2.4.0)
|
@@ -50,8 +49,7 @@ GEM
|
|
50
49
|
diff-lcs (>= 1.2.0, < 2.0)
|
51
50
|
rspec-support (~> 3.9.0)
|
52
51
|
rspec-support (3.9.3)
|
53
|
-
rubocop (0.
|
54
|
-
jaro_winkler (~> 1.5.1)
|
52
|
+
rubocop (0.83.0)
|
55
53
|
parallel (~> 1.10)
|
56
54
|
parser (>= 2.7.0.1)
|
57
55
|
rainbow (>= 2.2.2, < 4.0)
|
@@ -86,7 +84,7 @@ PLATFORMS
|
|
86
84
|
ruby
|
87
85
|
|
88
86
|
DEPENDENCIES
|
89
|
-
armitage-rubocop (~> 0.
|
87
|
+
armitage-rubocop (~> 0.83)
|
90
88
|
bundler (~> 2.1)
|
91
89
|
rake (~> 13.0)
|
92
90
|
rspec (~> 3.9)
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# SmartCore::Initializer · [![Gem Version](https://badge.fury.io/rb/smart_initializer.svg)](https://badge.fury.io/rb/smart_initializer) [![Build Status](https://travis-ci.org/smart-rb/smart_initializer.svg?branch=master)](https://travis-ci.org/smart-rb/smart_initializer)
|
2
2
|
|
3
|
-
A simple and convenient way to declare complex constructors
|
3
|
+
A simple and convenient way to declare complex constructors with a support for various commonly used type systems.
|
4
|
+
(**in active development**).
|
4
5
|
|
5
6
|
## Installation
|
6
7
|
|
@@ -72,8 +72,8 @@ class SmartCore::Initializer::Constructor
|
|
72
72
|
#
|
73
73
|
# @api private
|
74
74
|
# @since 0.1.0
|
75
|
+
# rubocop:disable Metrics/AbcSize
|
75
76
|
def prevent_attribute_insufficiency
|
76
|
-
required_options = klass.__options__.reject(&:has_default?).map(&:name)
|
77
77
|
required_parameter_count = klass.__params__.size
|
78
78
|
|
79
79
|
raise(
|
@@ -82,13 +82,23 @@ class SmartCore::Initializer::Constructor
|
|
82
82
|
"(given #{parameters.size}, expected #{required_parameter_count})"
|
83
83
|
) unless parameters.size == required_parameter_count
|
84
84
|
|
85
|
-
|
85
|
+
required_options = klass.__options__.reject(&:has_default?).map(&:name)
|
86
|
+
missing_options = required_options.reject { |option| options.key?(option) }
|
86
87
|
|
87
88
|
raise(
|
88
89
|
SmartCore::Initializer::OptionArgumentError,
|
89
90
|
"Missing options: #{missing_options.join(', ')}"
|
90
91
|
) if missing_options.any?
|
92
|
+
|
93
|
+
possible_options = klass.__options__.map(&:name)
|
94
|
+
unknown_options = options.keys - possible_options
|
95
|
+
|
96
|
+
raise(
|
97
|
+
SmartCore::Initializer::OptionArgumentError,
|
98
|
+
"Unknown options: #{unknown_options.join(', ')}"
|
99
|
+
) if unknown_options.any?
|
91
100
|
end
|
101
|
+
# rubocop:enable Metrics/AbcSize
|
92
102
|
|
93
103
|
# @return [Any]
|
94
104
|
#
|
data/smart_initializer.gemspec
CHANGED
@@ -37,6 +37,6 @@ Gem::Specification.new do |spec|
|
|
37
37
|
spec.add_development_dependency 'bundler', '~> 2.1'
|
38
38
|
spec.add_development_dependency 'rake', '~> 13.0'
|
39
39
|
spec.add_development_dependency 'rspec', '~> 3.9'
|
40
|
-
spec.add_development_dependency 'armitage-rubocop', '~> 0.
|
40
|
+
spec.add_development_dependency 'armitage-rubocop', '~> 0.83'
|
41
41
|
spec.add_development_dependency 'simplecov', '~> 0.18'
|
42
42
|
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.
|
4
|
+
version: 0.2.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: 2020-05-
|
11
|
+
date: 2020-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: smart_engine
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '0.
|
103
|
+
version: '0.83'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '0.
|
110
|
+
version: '0.83'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: simplecov
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|