Class: Kawaii::FullMatcher

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

Overview

Ensures the entire path is consumed by the wrapped Matcher instance.

Instance Method Summary (collapse)

Constructor Details

- (FullMatcher) initialize(matcher)

Creates a Kawaii::FullMatcher.

Parameters:

  • matcher (Matcher)

    wrapped matcher



123
124
125
# File 'lib/kawaii/matchers.rb', line 123

def initialize(matcher)
  @matcher = matcher
end

Instance Method Details

- (Match) match(path)

Tries to match the entire actual path.

Parameters:

  • path (String)

    the actual path from Rack env

Returns:

  • (Match)

    if the entire path does match or nil otherwise.



130
131
132
133
# File 'lib/kawaii/matchers.rb', line 130

def match(path)
  m = @matcher.match(path)
  m if m && m.remaining_path == ''
end