Created
April 16, 2009 07:03
-
-
Save carllerche/96282 to your computer and use it in GitHub Desktop.
Revisions
-
carllerche created this gist
Apr 16, 2009 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,6 @@ def generate(params, defaults = {}) unless (v_controller = (params[:controller] || defaults[:controller]).to_s) =~ /^(?-mix:[^\/.,;?]+)$/ raise ArgumentError, "Condition cannot be generated with #{params.inspect}" end "/#{params.delete(:controller) ; v_controller}#{if (params[:action] || params[:id]) && (v_action = (params[:action] || defaults[:action]).to_s) =~ /^(?-mix:[^\/.,;?]+)$/ ; "/#{params.delete(:action) ; v_action}#{if (params[:id]) && (v_id = (params[:id] || defaults[:id]).to_s) =~ /^(?-mix:[^\/.,;?]+)$/ ; "/#{params.delete(:id) ; v_id}" ; end}" ; end}" end