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



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

def matches?(request)
  self.accept_header = Apill::AcceptHeader.new(application:  application,
                                               header:       request.headers['Accept'])
end