rint 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +6 -2
- data/lib/interface/error/not_implemented_error.rb +1 -0
- data/lib/interface/helpers.rb +16 -17
- data/lib/interface/version.rb +1 -1
- data/rint.gemspec +2 -2
- metadata +10 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bfb938f77b08b5801a67e75b66191413020f3a423f5512559e830036a83af8e5
|
4
|
+
data.tar.gz: b3bb2c1375451ff0963bf2937ec736b8a0b55c7a53aaa1fbe29ffe4526d268a5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3375654cd952e65515633398eeeaca90f5c021c1f3d4d94eed5910eebbcd774dd7b91db82d2f84ef85a86b3318ac7a64ba1c6d5707617f36c27df36bf88541d5
|
7
|
+
data.tar.gz: 9ff143cfdedaf72543138c25b3f31e00dd5242664f0dab81815ec7abc350ad97638c675169df66cb75949af187abf4001cdeb6476e9a60cf770ddf539bf10769
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
|
-
## [0.2.
|
1
|
+
## [0.2.1]
|
2
|
+
- Improved test coverage and refactored some methods.
|
3
|
+
- Fixed security vulnerabilities (in development dependencies)
|
4
|
+
|
5
|
+
## [0.2.0]
|
2
6
|
- Add method arity check to _must_implement_ and refactored specs - @rodrigo-ehresmann
|
3
7
|
- Added coverage and build status configuration and badges.
|
4
8
|
|
5
9
|
## [0.1.0]
|
6
|
-
- Initial implementation, including CLI generator.
|
10
|
+
- Initial implementation, including CLI generator.
|
data/lib/interface/helpers.rb
CHANGED
@@ -5,38 +5,37 @@ module Interface
|
|
5
5
|
# Errors raised here identify the class_name that is not implementing or is
|
6
6
|
# implemented with the wrong arity required by the Interface.
|
7
7
|
def must_implement(*args)
|
8
|
-
args.each do |method|
|
9
|
-
|
10
|
-
method.each do |name, arity|
|
11
|
-
next if valid_method?(name, arity)
|
12
|
-
raise_interface_error(name, arity)
|
13
|
-
end
|
14
|
-
else
|
15
|
-
next if valid_method?(method)
|
16
|
-
raise_interface_error(method)
|
17
|
-
end
|
8
|
+
parsed_args(args).each do |method, arity|
|
9
|
+
raise_interface_error(method, arity) unless valid_method?(method, arity)
|
18
10
|
end
|
19
11
|
end
|
20
12
|
|
21
13
|
private
|
22
14
|
|
15
|
+
# Transform symbol arguments to a hash of nil arity
|
16
|
+
def parsed_args(args)
|
17
|
+
args.inject({}) do |memo, method|
|
18
|
+
memo.merge(method.is_a?(Hash) ? method : { method => nil })
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
23
22
|
def raise_interface_error(method_name, method_arity = nil)
|
24
23
|
raise Interface::Error::NotImplementedError.new(
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
24
|
+
class_name: self.class.name,
|
25
|
+
method_name: method_name,
|
26
|
+
method_arity: method_arity,
|
27
|
+
interface_name: self.class.ancestors.first
|
28
|
+
)
|
30
29
|
end
|
31
30
|
|
32
|
-
# Check if method is implemented and have the specified arity
|
33
|
-
# points to 'unlimited').
|
31
|
+
# Check if method is implemented and have the specified arity
|
34
32
|
def valid_method?(name, arity = nil)
|
35
33
|
respond_to?(name) && expected_arity?(name, arity)
|
36
34
|
end
|
37
35
|
|
38
36
|
def expected_arity?(method, arity)
|
39
37
|
return true unless arity
|
38
|
+
|
40
39
|
method_arity(method) == arity
|
41
40
|
end
|
42
41
|
|
data/lib/interface/version.rb
CHANGED
data/rint.gemspec
CHANGED
@@ -19,8 +19,8 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_development_dependency 'bundler', '~>
|
23
|
-
spec.add_development_dependency 'rake', '~>
|
22
|
+
spec.add_development_dependency 'bundler', '~> 2.2.10'
|
23
|
+
spec.add_development_dependency 'rake', '~> 12.3.3'
|
24
24
|
spec.add_development_dependency 'rspec', '~> 3.3'
|
25
25
|
spec.add_development_dependency 'simplecov', '~> 0.12'
|
26
26
|
spec.add_dependency 'thor', '~> 0.19'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rint
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Lopez
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-08-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.2.10
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 2.2.10
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 12.3.3
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 12.3.3
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -110,7 +110,7 @@ homepage: https://github.com/bluegod/rint
|
|
110
110
|
licenses:
|
111
111
|
- MIT
|
112
112
|
metadata: {}
|
113
|
-
post_install_message:
|
113
|
+
post_install_message:
|
114
114
|
rdoc_options: []
|
115
115
|
require_paths:
|
116
116
|
- lib
|
@@ -125,9 +125,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
- !ruby/object:Gem::Version
|
126
126
|
version: '0'
|
127
127
|
requirements: []
|
128
|
-
|
129
|
-
|
130
|
-
signing_key:
|
128
|
+
rubygems_version: 3.1.4
|
129
|
+
signing_key:
|
131
130
|
specification_version: 4
|
132
131
|
summary: Ruby interfaces made simple
|
133
132
|
test_files: []
|