class Rory::RouteMapper
Route
mapper, used to convert the entries in 'config/routes.rb' into a routing table for use by the dispatcher.
Public Class Methods
new()
click to toggle source
# File lib/rory/route_mapper.rb, line 13 def initialize @routes = [] @scope_options = {} end
set_routes(&block)
click to toggle source
# File lib/rory/route_mapper.rb, line 6 def set_routes(&block) mapper = new mapper.instance_exec(&block) mapper.routing_map end
Public Instance Methods
match(mask, options = {})
click to toggle source
# File lib/rory/route_mapper.rb, line 29 def match(mask, options = {}) options.merge!(@scope_options) options[:to] ||= mask.split('/').first @routes << Route.new(mask, options) end
routing_map()
click to toggle source
# File lib/rory/route_mapper.rb, line 18 def routing_map @routes end
scope(options = {}) { || ... }
click to toggle source
# File lib/rory/route_mapper.rb, line 22 def scope(options = {}, &block) previous_options, @scope_options = @scope_options, @scope_options.merge(options) yield @scope_options = previous_options end