proxy_method 1.2.8 → 1.2.9
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 +16 -16
- data/lib/proxy_method/version.rb +1 -1
- metadata +1 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: f195076f22b772b57c64d8e0afe50cad3439be1a9a9d77600b4f39f7bee132c0
         | 
| 4 | 
            +
              data.tar.gz: 858def85da8d7136b3d85bae784f0213cc821dea7936e762d70e0fb736351507
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 65e3277fc3cd9da097a8c68de2ebdd19a8842487949fa0e02a6cb848bb922b31d8099679ee990fbe8ff987f35f16ebbef8387853bc968c41bbdc413ec07338eb
         | 
| 7 | 
            +
              data.tar.gz: c2f16bc7f971e039a8c01d5e0434df0a8c5118b78876af6d1a22913a6c7fe964a54c94dbf65bd4d62f7dc0207e3b465b74914d1bb32c0c180fadc37bef40c84f
         | 
    
        data/README.md
    CHANGED
    
    | @@ -49,13 +49,13 @@ You can do this: | |
| 49 49 | 
             
                Turtle.create
         | 
| 50 50 | 
             
                # => RuntimeError: Disabled by proxy_method
         | 
| 51 51 |  | 
| 52 | 
            -
                Turtle.new.save
         | 
| 52 | 
            +
                Turtle.new.save  
         | 
| 53 53 | 
             
                # => RuntimeError: Disabled by proxy_method
         | 
| 54 54 |  | 
| 55 | 
            -
                Turtle.unproxied_create
         | 
| 55 | 
            +
                Turtle.unproxied_create  
         | 
| 56 56 | 
             
                # => 'created'
         | 
| 57 57 |  | 
| 58 | 
            -
                Turtle.new.unproxied_save
         | 
| 58 | 
            +
                Turtle.new.unproxied_save  
         | 
| 59 59 | 
             
                # => 'saved'
         | 
| 60 60 |  | 
| 61 61 | 
             
            Raise a custom error message:
         | 
| @@ -66,7 +66,7 @@ Raise a custom error message: | |
| 66 66 | 
             
                  proxy_method :save, raise: "Don't save here, use an interactor!"
         | 
| 67 67 | 
             
                end
         | 
| 68 68 |  | 
| 69 | 
            -
                CustomCow.new.save
         | 
| 69 | 
            +
                CustomCow.new.save  
         | 
| 70 70 | 
             
                # => RunTimeError: Don't save here, use an interactor!
         | 
| 71 71 |  | 
| 72 72 | 
             
            Specify multiple methods at once:
         | 
| @@ -77,10 +77,10 @@ Specify multiple methods at once: | |
| 77 77 | 
             
                  proxy_method :save, :update, raise: "Use an interactor!"
         | 
| 78 78 | 
             
                end
         | 
| 79 79 |  | 
| 80 | 
            -
                MultiMonkey.new.save
         | 
| 80 | 
            +
                MultiMonkey.new.save  
         | 
| 81 81 | 
             
                # => RunTimeError: Use an interactor!
         | 
| 82 82 |  | 
| 83 | 
            -
                MultiMonkey.new.update
         | 
| 83 | 
            +
                MultiMonkey.new.update  
         | 
| 84 84 | 
             
                # => RunTimeError: Use an interactor!    
         | 
| 85 85 |  | 
| 86 86 | 
             
            Supply your own prefix for the original, unproxied method:
         | 
| @@ -91,7 +91,7 @@ Supply your own prefix for the original, unproxied method: | |
| 91 91 | 
             
                  proxy_method :save, prefix: 'pelican_'
         | 
| 92 92 | 
             
                end
         | 
| 93 93 |  | 
| 94 | 
            -
                PrefixPelican.new.pelican_save
         | 
| 94 | 
            +
                PrefixPelican.new.pelican_save  
         | 
| 95 95 | 
             
                # => 'saved'
         | 
| 96 96 |  | 
| 97 97 | 
             
            Use an "unproxied" version of an instance:
         | 
| @@ -105,10 +105,10 @@ Use an "unproxied" version of an instance: | |
| 105 105 | 
             
                duck = DefaultDuck.new
         | 
| 106 106 | 
             
                duck_unproxied = duck.unproxied
         | 
| 107 107 |  | 
| 108 | 
            -
                duck.save
         | 
| 108 | 
            +
                duck.save  
         | 
| 109 109 | 
             
                # => RunTimeError: Disabled by proxy_method 
         | 
| 110 110 |  | 
| 111 | 
            -
                duck_unproxied.save
         | 
| 111 | 
            +
                duck_unproxied.save  
         | 
| 112 112 | 
             
                # => 'saved'
         | 
| 113 113 |  | 
| 114 114 |  | 
| @@ -122,10 +122,10 @@ You can also use an unproxied version of the entire class: | |
| 122 122 | 
             
                duck = DefaultDuck.new
         | 
| 123 123 | 
             
                duck_unproxied = DefaultDuck.unproxied.new
         | 
| 124 124 |  | 
| 125 | 
            -
                duck.save
         | 
| 125 | 
            +
                duck.save  
         | 
| 126 126 | 
             
                # => RunTimeError: Disabled by proxy_method 
         | 
| 127 127 |  | 
| 128 | 
            -
                duck_unproxied.save
         | 
| 128 | 
            +
                duck_unproxied.save  
         | 
| 129 129 | 
             
                # => 'saved'
         | 
| 130 130 |  | 
| 131 131 | 
             
            Run a custom block, instead of raising an exception at all. In other words, *actually* proxy the
         | 
| @@ -140,7 +140,7 @@ yourself: | |
| 140 140 | 
             
                  end
         | 
| 141 141 | 
             
                end
         | 
| 142 142 |  | 
| 143 | 
            -
                MethodicalMeerkat.new.save
         | 
| 143 | 
            +
                MethodicalMeerkat.new.save  
         | 
| 144 144 | 
             
                # => 'indirectly saved!'
         | 
| 145 145 |  | 
| 146 146 | 
             
            The object which is passed to the block is already unproxied, so it's free to use as you'd expect.
         | 
| @@ -155,10 +155,10 @@ From there, you can allow your proxied block it to be used for multiple methods: | |
| 155 155 | 
             
                  end
         | 
| 156 156 | 
             
                end
         | 
| 157 157 |  | 
| 158 | 
            -
                MethodicalMeerkat.new.save
         | 
| 158 | 
            +
                MethodicalMeerkat.new.save  
         | 
| 159 159 | 
             
                # => 'indirectly saved!'
         | 
| 160 160 |  | 
| 161 | 
            -
                MethodicalMeerkat.new.update
         | 
| 161 | 
            +
                MethodicalMeerkat.new.update  
         | 
| 162 162 | 
             
                # => 'indirectly updated!'    
         | 
| 163 163 |  | 
| 164 164 | 
             
            Provide your proxied block with args and a block of its own. The block will be given the
         | 
| @@ -173,10 +173,10 @@ so it works in much the same way. | |
| 173 173 | 
             
                  end
         | 
| 174 174 | 
             
                end
         | 
| 175 175 |  | 
| 176 | 
            -
                MethodicalMeerkat.new.save
         | 
| 176 | 
            +
                MethodicalMeerkat.new.save  
         | 
| 177 177 | 
             
                # => 'indirectly saved!'
         | 
| 178 178 |  | 
| 179 | 
            -
                MethodicalMeerkat.new.update
         | 
| 179 | 
            +
                MethodicalMeerkat.new.update  
         | 
| 180 180 | 
             
                # => 'indirectly updated!'    
         | 
| 181 181 |  | 
| 182 182 |  | 
    
        data/lib/proxy_method/version.rb
    CHANGED