Class: Waves::Matchers::Requested

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

Overview

Matches the MIME-type of the URI path (using the extension) and, failing that, falls back to the accept header

Use :extension or :ext for matching the extension itself or :accept to match the actual HTTP Accept header

Instance Method Summary collapse

Constructor Details

#initialize(val) ⇒ Requested

Returns a new instance of Requested.



14
# File 'lib/waves/matchers/requested.rb', line 14

def initialize( val ) ; @val = val ; end

Instance Method Details

#[](request) ⇒ Object

Proc-like interface



22
23
24
# File 'lib/waves/matchers/requested.rb', line 22

def [](request)
  call request
end

#call(request) ⇒ Object



16
17
18
# File 'lib/waves/matchers/requested.rb', line 16

def call( request )
  request.requested.include?( @val )
end