Class: Drillbit::AcceptHeader

Inherits:
Object
  • Object
show all
Defined in:
lib/drillbit/accept_header.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(application:, header:) ⇒ AcceptHeader

Returns a new instance of AcceptHeader.



7
8
9
10
# File 'lib/drillbit/accept_header.rb', line 7

def initialize(application:, header:)
  self.application       = application
  self.raw_accept_header = header || ''
end

Instance Attribute Details

#applicationObject

Returns the value of attribute application.



4
5
6
# File 'lib/drillbit/accept_header.rb', line 4

def application
  @application
end

#raw_accept_headerObject

Returns the value of attribute raw_accept_header.



4
5
6
# File 'lib/drillbit/accept_header.rb', line 4

def raw_accept_header
  @raw_accept_header
end

Instance Method Details

#content_typeObject



16
17
18
# File 'lib/drillbit/accept_header.rb', line 16

def content_type
  accept_header_data[1]
end

#invalid?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/drillbit/accept_header.rb', line 24

def invalid?
  accept_header_data.nil?
end

#to_sObject



28
29
30
# File 'lib/drillbit/accept_header.rb', line 28

def to_s
  raw_accept_header
end

#valid?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/drillbit/accept_header.rb', line 20

def valid?
  !invalid?
end

#versionObject



12
13
14
# File 'lib/drillbit/accept_header.rb', line 12

def version
  accept_header_data[2]
end