Module: Apill::Matchers::GenericMatcher

Included in:
AcceptHeaderMatcher, VersionMatcher
Defined in:
lib/apill/matchers/generic_matcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#accept_headerObject

Returns the value of attribute accept_header.



6
7
8
# File 'lib/apill/matchers/generic_matcher.rb', line 6

def accept_header
  @accept_header
end

#applicationObject

Returns the value of attribute application.



6
7
8
# File 'lib/apill/matchers/generic_matcher.rb', line 6

def application
  @application
end

Instance Method Details

#initialize(**args) ⇒ Object



9
10
11
12
13
# File 'lib/apill/matchers/generic_matcher.rb', line 9

def initialize(**args)
  args.each do |variable, value|
    self.send("#{variable}=", value)
  end
end

#matches?(request) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
18
# File 'lib/apill/matchers/generic_matcher.rb', line 15

def matches?(request)
  self.accept_header = get_accept_header(raw_header_from_headers: request.headers['Accept'],
                                         raw_header_from_params:  request.params['accept'])
end