http_router 0.3.8 → 0.3.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.
@@ -26,7 +26,7 @@ class HttpRouter
26
26
 
27
27
  # Returns the options used to create this route.
28
28
  def as_options
29
- {:matching => @matches_with, :conditions => @conditions, :default_values => @default_values, :name => @name, :partial => @partially_match}
29
+ {:matching => @matches_with, :conditions => @conditions, :default_values => @default_values, :name => @name, :partial => @partially_match, :arbitrary => @arbitrary}
30
30
  end
31
31
 
32
32
  # Creates a deep uncompiled copy of this route.
@@ -42,11 +42,12 @@ class HttpRouter
42
42
  # *default_value -- Maps to #default_value method.
43
43
  def with_options(options)
44
44
  if options
45
- name(options[:name]) if options[:name]
46
- matching(options[:matching]) if options[:matching]
47
- condition(options[:conditions]) if options[:conditions]
48
- default(options[:default_values]) if options[:default_values]
49
- partial(options[:partial]) if options[:partial]
45
+ name(options[:name]) if options[:name]
46
+ matching(options[:matching]) if options[:matching]
47
+ condition(options[:conditions]) if options[:conditions]
48
+ default(options[:default_values]) if options[:default_values]
49
+ partial(options[:partial]) if options[:partial]
50
+ Array(options[:arbitrary]).each{|a| arbitrary(&a)} if options[:arbitrary]
50
51
  end
51
52
  self
52
53
  end
@@ -171,6 +172,7 @@ class HttpRouter
171
172
 
172
173
  # Adds an arbitrary proc matcher to a Route. Receives either a block, or a proc. The proc will receive a Rack::Request object and must return true for the Route to be matched. Returns +self+.
173
174
  def arbitrary(proc = nil, &block)
175
+ guard_compiled
174
176
  @arbitrary << (proc || block)
175
177
  self
176
178
  end
@@ -1,4 +1,4 @@
1
1
  # encoding: utf-8
2
2
  class HttpRouter #:nodoc
3
- VERSION = '0.3.8'
3
+ VERSION = '0.3.9'
4
4
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: http_router
3
3
  version: !ruby/object:Gem::Version
4
- hash: 3
4
+ hash: 1
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 8
10
- version: 0.3.8
9
+ - 9
10
+ version: 0.3.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Joshua Hull