resugan 0.1.12 → 0.1.13
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 +21 -8
 - data/lib/resugan/object.rb +6 -0
 - data/lib/resugan/version.rb +1 -1
 - metadata +2 -2
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: ba18c2c784e29ca7493bbb579f33a75c31b41ae6
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: e47f70a4106daa799f18e3df9a157b2ba42ab50a
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: c9a89df390d48392b0526686d6aaf863f87c6e53385ef6d8449ccd2acfa7a1a38b7da5e7045a2032eab8c13ee8e5685a8a2085286556bb5bb7e354cb087c308c
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 1d8be70ec1599f09e87b1380eaaf98ef195f8948c08c19ba5a994114a05e94487bf86f15f45ccce6f74ae98e72d348dec9039f6f40029e67e20a40c735f64350
         
     | 
    
        data/README.md
    CHANGED
    
    | 
         @@ -155,11 +155,22 @@ if you want to make sure that listener only gets executed once you can pass an i 
     | 
|
| 
       155 
155 
     | 
    
         
             
            option:
         
     | 
| 
       156 
156 
     | 
    
         | 
| 
       157 
157 
     | 
    
         
             
            ```ruby
         
     | 
| 
       158 
     | 
    
         
            -
             
     | 
| 
      
 158 
     | 
    
         
            +
            _listener :event1, id: 'no_other_listener_like_this' do |array|
         
     | 
| 
       159 
159 
     | 
    
         
             
             # some code that gets executed
         
     | 
| 
       160 
160 
     | 
    
         
             
            end
         
     | 
| 
       161 
161 
     | 
    
         
             
            ```
         
     | 
| 
       162 
162 
     | 
    
         | 
| 
      
 163 
     | 
    
         
            +
            Or you can use the _listener! form which make sure a certain block is limited to
         
     | 
| 
      
 164 
     | 
    
         
            +
            only a single instance.
         
     | 
| 
      
 165 
     | 
    
         
            +
             
     | 
| 
      
 166 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 167 
     | 
    
         
            +
            2.times do |i|
         
     | 
| 
      
 168 
     | 
    
         
            +
              _listener! :event1 do |array|
         
     | 
| 
      
 169 
     | 
    
         
            +
                # There will be only one instance of this listener no matter how many times it is defined
         
     | 
| 
      
 170 
     | 
    
         
            +
              end
         
     | 
| 
      
 171 
     | 
    
         
            +
            end
         
     | 
| 
      
 172 
     | 
    
         
            +
            ```
         
     | 
| 
      
 173 
     | 
    
         
            +
             
     | 
| 
       163 
174 
     | 
    
         
             
            ## Customizing the Event dispatcher
         
     | 
| 
       164 
175 
     | 
    
         | 
| 
       165 
176 
     | 
    
         
             
            The way events are consumed is entirely customizable. You can register your own event dispatcher:
         
     | 
| 
         @@ -191,7 +202,7 @@ Or assign it to a specific namespace: 
     | 
|
| 
       191 
202 
     | 
    
         | 
| 
       192 
203 
     | 
    
         
             
            This allows you to use various queue backends per namespace, like resugan-worker for example.
         
     | 
| 
       193 
204 
     | 
    
         | 
| 
       194 
     | 
    
         
            -
             
     | 
| 
      
 205 
     | 
    
         
            +
            ### Debugging
         
     | 
| 
       195 
206 
     | 
    
         | 
| 
       196 
207 
     | 
    
         
             
            Sometimes you need to track where events are fired. You can do so by enabling line tracing:
         
     | 
| 
       197 
208 
     | 
    
         | 
| 
         @@ -212,9 +223,9 @@ puts(resugan { 
     | 
|
| 
       212 
223 
     | 
    
         
             
            {:event1=>[{:params=>{:_source=>"/Users/jedld/workspace/resugan/spec/resugan_spec.rb:144:in `block (5 levels) in <top (required)>'"}}]}
         
     | 
| 
       213 
224 
     | 
    
         
             
            ```
         
     | 
| 
       214 
225 
     | 
    
         | 
| 
       215 
     | 
    
         
            -
             
     | 
| 
      
 226 
     | 
    
         
            +
            ### Using Resugan::Engine::MarshalledInlineDispatcher
         
     | 
| 
       216 
227 
     | 
    
         | 
| 
       217 
     | 
    
         
            -
            By default, resugan uses the Resugan::Engine::InlineDispatcher as the default dispatcher for 
     | 
| 
      
 228 
     | 
    
         
            +
            By default, resugan uses the Resugan::Engine::InlineDispatcher as the default dispatcher for
         
     | 
| 
       218 
229 
     | 
    
         
             
            all namespaces. For performance reasons, params passed to the _fire method are passed as is, but there are
         
     | 
| 
       219 
230 
     | 
    
         
             
            times when you want to simulate params that are passed using JSON.parse as is the case
         
     | 
| 
       220 
231 
     | 
    
         
             
            when using a custom dispatcher that uses redis (see resugan-worker). In this case you may set MarshalledInlineDispatcher
         
     | 
| 
         @@ -224,12 +235,12 @@ as the default dispatcher for test and development environment instead (e.g. rai 
     | 
|
| 
       224 
235 
     | 
    
         
             
            Resugan::Kernel.set_default_dispatcher(Resugan::Engine::MarshalledInlineDispatcher) if Rails.env.development? || Rails.env.test?
         
     | 
| 
       225 
236 
     | 
    
         
             
            ```
         
     | 
| 
       226 
237 
     | 
    
         | 
| 
       227 
     | 
    
         
            -
             
     | 
| 
      
 238 
     | 
    
         
            +
            Related Projects
         
     | 
| 
      
 239 
     | 
    
         
            +
            =================
         
     | 
| 
       228 
240 
     | 
    
         | 
| 
       229 
241 
     | 
    
         
             
            Below are projects that extend resugan.
         
     | 
| 
       230 
242 
     | 
    
         | 
| 
       231 
     | 
    
         
            -
            Resugan Worker
         
     | 
| 
       232 
     | 
    
         
            -
            --------------
         
     | 
| 
      
 243 
     | 
    
         
            +
            ### Resugan Worker
         
     | 
| 
       233 
244 
     | 
    
         | 
| 
       234 
245 
     | 
    
         
             
            A project that wraps resugan listeners to be consumed using an external worker. Think of this as a redis queue backend.
         
     | 
| 
       235 
246 
     | 
    
         
             
            Can also be used as a sample on how to extend resugan.
         
     | 
| 
         @@ -238,7 +249,9 @@ https://github.com/jedld/resugan-worker 
     | 
|
| 
       238 
249 
     | 
    
         | 
| 
       239 
250 
     | 
    
         
             
            ## Similar Projects
         
     | 
| 
       240 
251 
     | 
    
         | 
| 
       241 
     | 
    
         
            -
            wisper (https://github.com/krisleech/wisper) - An excellent gem that focuses on a pub-sub model. Though its global listeners somehow have the same effect though in a syntactically different way 
     | 
| 
      
 252 
     | 
    
         
            +
            wisper (https://github.com/krisleech/wisper) - An excellent gem that focuses on a coupled pub-sub model. Though its global listeners somehow have the same effect though in a syntactically different way.
         
     | 
| 
      
 253 
     | 
    
         
            +
             
     | 
| 
      
 254 
     | 
    
         
            +
            event_bus (https://github.com/kevinrutherford/event_bus) - Loosely coupled pub-sub similar to resugan
         
     | 
| 
       242 
255 
     | 
    
         | 
| 
       243 
256 
     | 
    
         
             
            ## Development
         
     | 
| 
       244 
257 
     | 
    
         | 
    
        data/lib/resugan/object.rb
    CHANGED
    
    
    
        data/lib/resugan/version.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: resugan
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.1. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.1.13
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Joseph Emmanuel Dayo
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2016-06- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-06-30 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     |