Class: Atatus::Transport::Headers Private
- Inherits:
-
Object
- Object
- Atatus::Transport::Headers
- Defined in:
- lib/atatus/transport/headers.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Constant Summary collapse
- HEADERS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
{ 'Content-Type' => 'application/x-ndjson', 'Transfer-Encoding' => 'chunked' }.freeze
- GZIP_HEADERS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
HEADERS.merge( 'Content-Encoding' => 'gzip' ).freeze
Instance Attribute Summary collapse
- #hash ⇒ Object private
Instance Method Summary collapse
- #[](key) ⇒ Object private
- #[]=(key, value) ⇒ Object private
- #chunked ⇒ Object private
-
#initialize(config, initial: {}) ⇒ Headers
constructor
private
A new instance of Headers.
- #merge(other) ⇒ Object private
- #merge!(other) ⇒ Object private
- #to_h ⇒ Object private
Constructor Details
#initialize(config, initial: {}) ⇒ Headers
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Headers.
32 33 34 35 |
# File 'lib/atatus/transport/headers.rb', line 32 def initialize(config, initial: {}) @config = config @hash = build!(initial) end |
Instance Attribute Details
#hash ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
37 38 39 |
# File 'lib/atatus/transport/headers.rb', line 37 def hash @hash end |
Instance Method Details
#[](key) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
39 40 41 |
# File 'lib/atatus/transport/headers.rb', line 39 def [](key) @hash[key] end |
#[]=(key, value) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
43 44 45 |
# File 'lib/atatus/transport/headers.rb', line 43 def []=(key, value) @hash[key] = value end |
#chunked ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
60 61 62 63 64 |
# File 'lib/atatus/transport/headers.rb', line 60 def chunked merge( @config.http_compression? ? GZIP_HEADERS : HEADERS ) end |
#merge(other) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
47 48 49 |
# File 'lib/atatus/transport/headers.rb', line 47 def merge(other) self.class.new(@config, initial: @hash.merge(other)) end |
#merge!(other) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
51 52 53 54 |
# File 'lib/atatus/transport/headers.rb', line 51 def merge!(other) @hash.merge!(other) self end |
#to_h ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
56 57 58 |
# File 'lib/atatus/transport/headers.rb', line 56 def to_h @hash end |