public Method

Route.generation_requirements

Produce a condition expression that will check the requirements of this route upon generation.

Source Code

# File action_controller/routing/route.rb, line 62
def generation_requirements
  requirement_conditions = requirements.collect do |key, req|
    if req.is_a? Regexp
      value_regexp = Regexp.new "\\A#{req.source}\\Z"
      "hash[:#{key}] && #{value_regexp.inspect} =~ options[:#{key}]"
    else
      "hash[:#{key}] == #{req.inspect}"
    end
  end
  requirement_conditions * ' && ' unless requirement_conditions.empty?
end
Comments

Have your say
Please use Textile formatting (click here for a cheat sheet). Use <code/> and <pre/> for code samples.
Click here to login with OpenID to to post comments.