Class: Apill::AcceptHeader
- Inherits:
-
Object
- Object
- Apill::AcceptHeader
- Defined in:
- lib/apill/accept_header.rb
Instance Attribute Summary collapse
-
#application ⇒ Object
Returns the value of attribute application.
-
#raw_accept_header ⇒ Object
Returns the value of attribute raw_accept_header.
Instance Method Summary collapse
- #content_type ⇒ Object
-
#initialize(application:, header:) ⇒ AcceptHeader
constructor
A new instance of AcceptHeader.
- #invalid? ⇒ Boolean
- #to_s ⇒ Object
- #valid? ⇒ Boolean
- #version ⇒ Object
Constructor Details
#initialize(application:, header:) ⇒ AcceptHeader
Returns a new instance of AcceptHeader.
6 7 8 9 |
# File 'lib/apill/accept_header.rb', line 6 def initialize(application:, header:) self.application = application self.raw_accept_header = header || '' end |
Instance Attribute Details
#application ⇒ Object
Returns the value of attribute application.
3 4 5 |
# File 'lib/apill/accept_header.rb', line 3 def application @application end |
#raw_accept_header ⇒ Object
Returns the value of attribute raw_accept_header.
3 4 5 |
# File 'lib/apill/accept_header.rb', line 3 def raw_accept_header @raw_accept_header end |
Instance Method Details
#content_type ⇒ Object
15 16 17 |
# File 'lib/apill/accept_header.rb', line 15 def content_type accept_header_data[1] end |
#invalid? ⇒ Boolean
23 24 25 |
# File 'lib/apill/accept_header.rb', line 23 def invalid? accept_header_data.nil? end |
#to_s ⇒ Object
27 28 29 |
# File 'lib/apill/accept_header.rb', line 27 def to_s raw_accept_header end |
#valid? ⇒ Boolean
19 20 21 |
# File 'lib/apill/accept_header.rb', line 19 def valid? !invalid? end |
#version ⇒ Object
11 12 13 |
# File 'lib/apill/accept_header.rb', line 11 def version accept_header_data[2] end |