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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 94920569dcb0c8f3ceabdadeeae16ad559b7893e
4
- data.tar.gz: a38868d50fea6d32ec02841aab0c1d6745e90188
2
+ SHA256:
3
+ metadata.gz: bfb938f77b08b5801a67e75b66191413020f3a423f5512559e830036a83af8e5
4
+ data.tar.gz: b3bb2c1375451ff0963bf2937ec736b8a0b55c7a53aaa1fbe29ffe4526d268a5
5
5
  SHA512:
6
- metadata.gz: 5b69a6e1bc56acae37c0d95a1d7ea5ab72e0a7035e8aae42d6fc788388fcdfee41462501b09ca6a5227c5b8f6e1a7caff4a76b0b060311280a53b7d7b330e198
7
- data.tar.gz: 8466fca69539bec30f10707b03f9d106f2c24b356391597315aaf03605ea34af6ec2c413de47518d3009ee30d4bd9897a02f9af3b7af17f5bce72f8823bd1625
6
+ metadata.gz: 3375654cd952e65515633398eeeaca90f5c021c1f3d4d94eed5910eebbcd774dd7b91db82d2f84ef85a86b3318ac7a64ba1c6d5707617f36c27df36bf88541d5
7
+ data.tar.gz: 9ff143cfdedaf72543138c25b3f31e00dd5242664f0dab81815ec7abc350ad97638c675169df66cb75949af187abf4001cdeb6476e9a60cf770ddf539bf10769
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
- ## [0.2.0 (unreleased)]
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.
@@ -11,6 +11,7 @@ module Interface
11
11
 
12
12
  def error_message(class_name, method_name, method_arity, interface_name)
13
13
  arity = method_arity ? "/#{method_arity}" : ""
14
+
14
15
  "Expected #{class_name} to implement #{method_name}#{arity} for interface #{interface_name}"
15
16
  end
16
17
  end
@@ -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
- if method.is_a? Hash
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
- class_name: self.class.name,
26
- method_name: method_name,
27
- method_arity: method_arity,
28
- interface_name: self.class.ancestors.first
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 (where nil
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
 
@@ -1,3 +1,3 @@
1
1
  module Interface
2
- VERSION = '0.2.0'
2
+ VERSION = '0.2.1'
3
3
  end
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', '~> 1.10'
23
- spec.add_development_dependency 'rake', '~> 10.0'
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.0
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: 2016-09-06 00:00:00.000000000 Z
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: '1.10'
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: '1.10'
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: '10.0'
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: '10.0'
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
- rubyforge_project:
129
- rubygems_version: 2.5.1
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: []