Module: WhatThe::RouteMatcher
- Defined in:
- lib/what_the/route_matcher.rb
Defined Under Namespace
Classes: Matcher
Instance Method Summary collapse
- #match_controller(route_controller, params = {}, &block) ⇒ Object
- #with_route(html_method, routes) ⇒ Object
Instance Method Details
#match_controller(route_controller, params = {}, &block) ⇒ Object
12 13 14 15 16 |
# File 'lib/what_the/route_matcher.rb', line 12 def match_controller(route_controller, params = {}, &block) @route_matcher = RouteMatcher::Matcher.new(route_controller, params) yield @route_matcher = nil end |
#with_route(html_method, routes) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/what_the/route_matcher.rb', line 18 def with_route(html_method, routes) matcher = @route_matcher routes.each do |path, method| it "routes #{html_method} #{path} to #{matcher.route_controller}##{method} #{matcher.with_params}" do { html_method => "#{path}" }.should route_to( {:controller => matcher.route_controller, :action => method.to_s }.merge(matcher.route_params) ) end end end |