cottontail 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cottontail.rb +7 -8
- data/lib/cottontail/version.rb +1 -1
- metadata +2 -2
data/lib/cottontail.rb
CHANGED
@@ -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
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
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
|
|
data/lib/cottontail/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: cottontail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
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-
|
13
|
+
date: 2012-03-06 00:00:00 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bunny
|