cottontail 0.1.2 → 0.1.3

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.
@@ -54,7 +54,7 @@ module Cottontail
54
54
  # route! message
55
55
  # end
56
56
  def subscribe( options = {}, &block )
57
- set :subscribe, [options, compile!("subscribe", &block)]
57
+ set :subscribe, [ options, compile!("subscribe", &block) ]
58
58
  end
59
59
 
60
60
  # Defines routing on class level
@@ -63,8 +63,8 @@ module Cottontail
63
63
  # route "message.sent" do
64
64
  # ... stuff to do ...
65
65
  # end
66
- def route( key, &block )
67
- @routes[key] = compile!("route_#{key}", &block)
66
+ def route( key, options = {}, &block )
67
+ @routes[key] = [ options, compile!("route_#{key}", &block) ]
68
68
  end
69
69
 
70
70
  # Define error handlers
@@ -204,11 +204,10 @@ module Cottontail
204
204
  def route!( message )
205
205
  @message = message
206
206
 
207
- if block = routes[routing_key]
208
- block.call(self)
209
- else
210
- raise Cottontail::RouteNotFound.new(routing_key)
211
- end
207
+ options, block = routes[routing_key]
208
+
209
+ raise Cottontail::RouteNotFound.new(routing_key) if block.nil?
210
+ block.call(self)
212
211
  end
213
212
 
214
213
 
@@ -1,3 +1,3 @@
1
1
  module Cottontail
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: cottontail
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.1.2
5
+ version: 0.1.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Rudolf Schmidt
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2012-02-29 00:00:00 Z
13
+ date: 2012-03-06 00:00:00 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bunny