interfaceable 0.1.1 → 0.1.2
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/README.md +2 -2
 - data/lib/interfaceable/version.rb +1 -1
 - data/lib/interfaceable.rb +6 -1
 - metadata +3 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: fd1c5e3e374f3cf828348678b04342a04e332598682e16e95cbb69bf60a84da2
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 2dfc160484c025e9ec543849ec4b5c9d3e681493caa290b7bab5ae9d47754ef3
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 8987daa2e42f955ae1099b67e6787556f1c49e6d2b563f7571db6734d34fee5c1d6636f0bd5c9fc735d7400d4972fdbb3cc70b4ad3f51be04ce3799b7f4fa48a
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 2ffcdadc6dfb51bb9cd1a0dc04cd316f2686ef53dcc98b0918fa4b48cf37a100a7161efd16b0751a5b75a50f5221766e9226ea60ab22058410a775985dd58e82
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -46,7 +46,7 @@ Correctly! E.g.: 
     | 
|
| 
       46 
46 
     | 
    
         
             
            class Giffgaff
         
     | 
| 
       47 
47 
     | 
    
         
             
              def call(number); end
         
     | 
| 
       48 
48 
     | 
    
         | 
| 
       49 
     | 
    
         
            -
              def text(number); end
         
     | 
| 
      
 49 
     | 
    
         
            +
              def text(number, text = ''); end
         
     | 
| 
       50 
50 
     | 
    
         
             
            end
         
     | 
| 
       51 
51 
     | 
    
         
             
            ```
         
     | 
| 
       52 
52 
     | 
    
         | 
| 
         @@ -55,7 +55,7 @@ Will fail because of method signature mismatch: 
     | 
|
| 
       55 
55 
     | 
    
         
             
                Giffgaff must implement correctly: (Interfaceable::Error)
         
     | 
| 
       56 
56 
     | 
    
         
             
                  - Carrier#text:
         
     | 
| 
       57 
57 
     | 
    
         
             
                    - expected arguments: (req, req)
         
     | 
| 
       58 
     | 
    
         
            -
                    - actual arguments: (req)
         
     | 
| 
      
 58 
     | 
    
         
            +
                    - actual arguments: (req, opt=)
         
     | 
| 
       59 
59 
     | 
    
         | 
| 
       60 
60 
     | 
    
         
             
            ### Rails
         
     | 
| 
       61 
61 
     | 
    
         | 
    
        data/lib/interfaceable.rb
    CHANGED
    
    | 
         @@ -13,18 +13,23 @@ module Interfaceable 
     | 
|
| 
       13 
13 
     | 
    
         
             
              def implements(*interfaces)
         
     | 
| 
       14 
14 
     | 
    
         
             
                (@interfaces ||= []).push(*interfaces)
         
     | 
| 
       15 
15 
     | 
    
         | 
| 
      
 16 
     | 
    
         
            +
                @exceptions_trace ||= TracePoint.trace(:raise) do |t|
         
     | 
| 
      
 17 
     | 
    
         
            +
                  @exception_raised_during_class_definition = true if self == t.self
         
     | 
| 
      
 18 
     | 
    
         
            +
                end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
       16 
20 
     | 
    
         
             
                # rubocop:disable Naming/MemoizedInstanceVariableName
         
     | 
| 
       17 
21 
     | 
    
         
             
                @interfaceable_trace ||= TracePoint.trace(:end) do |t|
         
     | 
| 
       18 
22 
     | 
    
         
             
                  # simplecov does not see inside this block
         
     | 
| 
       19 
23 
     | 
    
         
             
                  # :nocov:
         
     | 
| 
       20 
24 
     | 
    
         
             
                  # rubocop:enable Naming/MemoizedInstanceVariableName
         
     | 
| 
       21 
25 
     | 
    
         
             
                  if self == t.self
         
     | 
| 
       22 
     | 
    
         
            -
                     
     | 
| 
      
 26 
     | 
    
         
            +
                    if !@exception_raised_during_class_definition && !(errors = ImplementationCheck.new(self).perform(@interfaces)).empty?
         
     | 
| 
       23 
27 
     | 
    
         
             
                      error_message = ErrorFormatter.new(self).format_errors(errors)
         
     | 
| 
       24 
28 
     | 
    
         
             
                      raise(Error, error_message)
         
     | 
| 
       25 
29 
     | 
    
         
             
                    end
         
     | 
| 
       26 
30 
     | 
    
         | 
| 
       27 
31 
     | 
    
         
             
                    t.disable
         
     | 
| 
      
 32 
     | 
    
         
            +
                    @exceptions_trace.disable
         
     | 
| 
       28 
33 
     | 
    
         
             
                  end
         
     | 
| 
       29 
34 
     | 
    
         
             
                  # :nocov:
         
     | 
| 
       30 
35 
     | 
    
         
             
                end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: interfaceable
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.2
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - artemave
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2022-03-30 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies: []
         
     | 
| 
       13 
13 
     | 
    
         
             
            description: 
         
     | 
| 
       14 
14 
     | 
    
         
             
            email:
         
     | 
| 
         @@ -53,7 +53,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       53 
53 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       54 
54 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       55 
55 
     | 
    
         
             
            requirements: []
         
     | 
| 
       56 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
      
 56 
     | 
    
         
            +
            rubygems_version: 3.1.6
         
     | 
| 
       57 
57 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       58 
58 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       59 
59 
     | 
    
         
             
            summary: Strict interfaces in Ruby
         
     |