--- !ruby/object:RI::MethodDescription 
aliases: []

block_params: 
comment: 
- !ruby/struct:SM::Flow::P 
  body: Defines the <tt>conditions</tt> that are required to match a Request. Each <tt>condition</tt> is applied to a method of the Request object. Conditions can also be applied to segments of the <tt>path</tt>.
- !ruby/struct:SM::Flow::P 
  body: "If #match is passed a block, it will create a new route scope with the conditions passed to it and yield to the block such that all routes that are defined in the block have the conditions applied to them."
- !ruby/struct:SM::Flow::H 
  level: 4
  text: Parameters
- !ruby/object:SM::Flow::LIST 
  contents: 
  - !ruby/struct:SM::Flow::LI 
    label: "path<String, Regexp>:"
    body: The pattern against which Merb::Request path is matched.
  - !ruby/struct:SM::Flow::P 
    body: "When <tt>path</tt> is a String, any substring that is wrapped in parenthesis is considered optional and any segment that begins with a colon, ex.: &quot;:login&quot;, defines both a capture and a named param. Extra conditions can then be applied each named param individually."
  - !ruby/struct:SM::Flow::P 
    body: When <tt>path</tt> is a Regexp, the pattern is left untouched and the Merb::Request path is matched against it as is.
  - !ruby/struct:SM::Flow::P 
    body: <tt>path</tt> is optional.
  - !ruby/struct:SM::Flow::LI 
    label: "conditions<Hash>:"
    body: Additional conditions that the request must meet in order to match. The keys must be the names of previously defined path segments or be methods that the Merb::Request instance will respond to. The value is the string or regexp that matched the returned value. Conditions are inherited by child routes.
  - !ruby/struct:SM::Flow::LI 
    label: "&block:"
    body: "All routes defined in the block will be scoped to the conditions defined by the #match method."
  type: :NOTE
- !ruby/struct:SM::Flow::H 
  level: 4
  text: Block parameters
- !ruby/object:SM::Flow::LIST 
  contents: 
  - !ruby/struct:SM::Flow::LI 
    label: "r<Behavior>:"
    body: <tt>optional</tt> - The match behavior object.
  type: :NOTE
- !ruby/struct:SM::Flow::H 
  level: 4
  text: Returns
- !ruby/object:SM::Flow::LIST 
  contents: 
  - !ruby/struct:SM::Flow::LI 
    label: "Behavior:"
    body: A new instance of Behavior with the specified path and conditions.
  type: :NOTE
- !ruby/struct:SM::Flow::P 
  body: "<tt>Tip</tt>: When nesting always make sure the most inner sub-match registers a Route and doesn't just return new Behaviors."
- !ruby/struct:SM::Flow::H 
  level: 4
  text: Examples
- !ruby/struct:SM::Flow::VERB 
  body: "  # registers /foo/bar to controller =&gt; &quot;foo&quot;, :action =&gt; &quot;bar&quot;\n  # and /foo/baz to controller =&gt; &quot;foo&quot;, :action =&gt; &quot;baz&quot;\n  match(&quot;/foo&quot;) do\n    match(&quot;/bar&quot;).to(:controller =&gt; &quot;foo&quot;, :action =&gt; &quot;bar&quot;)\n    match(&quot;/baz&quot;).to(:controller =&gt; &quot;foo&quot;, :action =&gt; &quot;caz&quot;)\n  end\n\n  # Checks the format of the segments against the specified Regexp\n  match(&quot;/:string/:number&quot;, :string =&gt; /[a-z]+/, :number =&gt; /\\d+/).\n    to(:controller =&gt; &quot;string_or_numbers&quot;)\n\n  # Equivalent to the default_route\n  match(&quot;/:controller(/:action(:id))(.:format)&quot;).register\n\n  #match only if the browser string contains MSIE or Gecko\n  match(&quot;/foo&quot;, :user_agent =&gt; /(MSIE|Gecko)/ )\n       .to(:controller =&gt; 'foo', :action =&gt; 'popular')\n\n  # Route GET and POST requests to different actions (see also #resources)\n  r.match('/foo', :method =&gt; :get).to(:action =&gt; 'show')\n  r.match('/foo', :method =&gt; :post).to(:action =&gt; 'create')\n\n  # match also takes regular expressions\n\n  r.match(%r[/account/([a-z]{4,6})]).to(:controller =&gt; &quot;account&quot;,\n     :action =&gt; &quot;show&quot;, :id =&gt; &quot;[1]&quot;)\n\n  r.match(%r{/?(en|es|fr|be|nl)?}).to(:language =&gt; &quot;[1]&quot;) do\n    match(&quot;/guides/:action/:id&quot;).to(:controller =&gt; &quot;tour_guides&quot;)\n  end\n"
- !ruby/struct:SM::Flow::P 
  body: ":api: public"
full_name: Merb::Router::Behavior#match
is_singleton: false
name: match
params: (path = {}, conditions = {}, &block)
visibility: public
