lib/usher/route.rb in joshbuddy-usher-0.2.0 vs lib/usher/route.rb in joshbuddy-usher-0.2.1
- old
+ new
@@ -1,11 +1,11 @@
$:.unshift File.dirname(__FILE__)
require 'route/path'
require 'route/splitter'
require 'route/variable'
-require 'route/http'
+require 'route/request_method'
class Usher
class Route
attr_reader :paths, :original_path, :requirements, :conditions, :params, :primary_path
@@ -16,10 +16,18 @@
@conditions = options.delete(:conditions)
@transformers = options.delete(:transformers)
@paths = Splitter.new(@original_path, @requirements, @transformers).paths.collect {|path| Path.new(self, path)}
@primary_path = @paths.first
end
-
+
+
+ # Sets +options+ on a route
+ #
+ # Request = Struct.new(:path)
+ # set = Usher.new
+ # route = set.add_route('/test')
+ # route.to(:controller => 'testing', :action => 'index')
+ # set.recognize(Request.new('/test')).first.params => {:controller => 'testing', :action => 'index'}
def to(options)
@params = options
self
end