message_router 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.
@@ -18,7 +18,7 @@ class MessageRouter
18
18
  #
19
19
  # # Matches if the first word of env['body'] is PING (case insensitive).
20
20
  # # Overwrite #default_attribute in your router to match against a
21
- # # different attribute.
21
+ # # different value.
22
22
  # match 'ping' do
23
23
  # PingCounter.increment!
24
24
  # send_reply 'pong', env
@@ -26,7 +26,7 @@ class MessageRouter
26
26
  #
27
27
  # # Matches if env['body'] matches the given Regexp.
28
28
  # # Overwrite #default_attribute in your router to match against a
29
- # # different attribute.
29
+ # # different value.
30
30
  # match /\Ahelp/i do
31
31
  # SupportQueue.contact_asap(env['from'])
32
32
  # send_reply 'Looks like you need some help. Hold tight someone will call you soon.', env
@@ -277,7 +277,7 @@ class MessageRouter
277
277
 
278
278
  case should_i
279
279
  when Regexp, String
280
- normalize_match_params default_attribute => should_i
280
+ Proc.new { attr_matches? default_attribute, should_i }
281
281
 
282
282
  when TrueClass, FalseClass, NilClass
283
283
  Proc.new { should_i }
@@ -322,7 +322,7 @@ class MessageRouter
322
322
  end
323
323
 
324
324
  def default_attribute
325
- 'body'
325
+ env['body']
326
326
  end
327
327
  end
328
328
  end
@@ -1,3 +1,3 @@
1
1
  class MessageRouter
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -80,7 +80,7 @@ describe MessageRouter::Router do
80
80
  match(/bean/) { env['result'] = 'magical fruit' }
81
81
 
82
82
  def default_attribute
83
- 'tacos'
83
+ env['tacos']
84
84
  end
85
85
  end.new
86
86
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: message_router
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 2
10
- version: 0.1.2
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brad Gessler