Class: Kawaii::Match

Inherits:
Object
  • Object
show all
Defined in:
lib/kawaii/matchers.rb

Overview

Result of matching a path.

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (Match) initialize(remaining_path, params = {})

Creates a new match result.

Parameters:

  • remaining_path (String)

    what is left of the actual path after Kawaii::Matcher#match consumed the matching portion

  • params (Hash) (defaults to: {})

    params extracted from paths such as /users/:id



16
17
18
19
# File 'lib/kawaii/matchers.rb', line 16

def initialize(remaining_path, params = {})
  @remaining_path = remaining_path
  @params = params
end

Instance Attribute Details

- (Object) params (readonly)

Hash containing params extracted from paths such as /users/:user_id/posts/:post_id



10
11
12
# File 'lib/kawaii/matchers.rb', line 10

def params
  @params
end

- (Object) remaining_path (readonly)

What is left of the actual path after Kawaii::Matcher#match consumed the matching portion.



7
8
9
# File 'lib/kawaii/matchers.rb', line 7

def remaining_path
  @remaining_path
end