duckface-interfaces 0.0.3 → 0.0.4

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
  SHA1:
3
- metadata.gz: 00d6fb73ecee350b171fbcee1cc119d9dd9323cb
4
- data.tar.gz: a17598b3ebbc212ca731e8d30f57e4caa9a10ebc
3
+ metadata.gz: 2595e9a679d9be84caf8e0afbf4c942fe3622267
4
+ data.tar.gz: 01d464a555e12df3ffad3ecbb97d48d656b65abc
5
5
  SHA512:
6
- metadata.gz: 1e9b94fe6673a539bfa4d487133e67b9c2bfe7eaaf2382f300b9a2d2791f7b10716503f785662cb79b6986495b1acfa2b6cdf62adbd601c0a55dce8df7b0c1fe
7
- data.tar.gz: c554f1d3674e99bee366f1dd476d6434eb7801f6ac3a1a5fb3f51ed2ed03fff488605382f3115527ae012ecef9cc59cae036305b89b34b195a83f824052deebe
6
+ metadata.gz: 2369548a1f3f4f9c3b181a2af47962f0557171c1d22d17b9d60c554c6d4e9ec0176671b9622ca858f9fb16e54e433629f2e28a7f7be6a7a0d0229aa3d38a6d2b
7
+ data.tar.gz: c680789f43194c1f9ceb80c5923bd56245ab7d8630b341beb88a59adf9deb6c2a65d420fac1b541f923fbf788108f2394fdf45beb02de31033764de0fe409d50
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ 0.0.4
2
+
3
+ * Add support for checking Dry::Struct's against an interface
4
+
1
5
  0.0.3
2
6
 
3
7
  * `Class.check_it_implements` now returns a `CheckSession`.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- duckface-interfaces (0.0.2)
4
+ duckface-interfaces (0.0.4)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -32,7 +32,7 @@ GEM
32
32
  http_parser.rb (~> 0.6.0)
33
33
  equalizer (0.0.11)
34
34
  eventmachine (1.2.3)
35
- ffi (1.9.18)
35
+ ffi (1.9.25)
36
36
  formatador (0.2.5)
37
37
  guard (2.14.1)
38
38
  formatador (>= 0.2.4)
@@ -166,4 +166,4 @@ DEPENDENCIES
166
166
  spring-watcher-listen
167
167
 
168
168
  BUNDLED WITH
169
- 1.16.4
169
+ 1.16.5
@@ -11,11 +11,19 @@ module Duckface
11
11
  end
12
12
 
13
13
  def parameters_for_comparison
14
- @parameters_for_comparison ||= ParameterPairs.new(parameters).for_comparison
14
+ @parameters_for_comparison ||= begin
15
+ return [] if present_in_schema?
16
+
17
+ ParameterPairs.new(parameters).for_comparison
18
+ end
15
19
  end
16
20
 
17
21
  def owner
18
- @owner ||= implementation.owner
22
+ @owner ||= begin
23
+ return @klass if present_in_schema?
24
+
25
+ implementation.owner
26
+ end
19
27
  end
20
28
 
21
29
  private
@@ -24,6 +32,17 @@ module Duckface
24
32
  @implementation ||= @klass.public_instance_method(@method_name)
25
33
  end
26
34
 
35
+ def present_in_schema?
36
+ return false unless schema?
37
+ @klass.schema.keys.include?(@method_name)
38
+ end
39
+
40
+ def schema?
41
+ return false unless @klass.respond_to?(:schema)
42
+
43
+ @klass.schema.respond_to?(:keys)
44
+ end
45
+
27
46
  def parameters
28
47
  implementation.parameters - Constants::IGNORABLE_PARAMETERS
29
48
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Duckface
4
- VERSION = '0.0.3'
4
+ VERSION = '0.0.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: duckface-interfaces
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bellroy Tech Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-25 00:00:00.000000000 Z
11
+ date: 2019-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler