Class: Knj::Http2::Response
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
Instance Method Summary collapse
- #body ⇒ Object
- #charset ⇒ Object
- #code ⇒ Object
- #contenttype ⇒ Object
- #header(key) ⇒ Object
- #header?(key) ⇒ Boolean
- #headers ⇒ Object
- #http_version ⇒ Object
-
#initialize(args = {}) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(args = {}) ⇒ Response
Returns a new instance of Response.
416 417 418 419 420 |
# File 'lib/knj/http2.rb', line 416 def initialize(args = {}) @args = args @args[:headers] = {} if !@args.key?(:headers) @args[:body] = "" if !@args.key?(:body) end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
414 415 416 |
# File 'lib/knj/http2.rb', line 414 def args @args end |
Instance Method Details
#body ⇒ Object
444 445 446 |
# File 'lib/knj/http2.rb', line 444 def body return @args[:body] end |
#charset ⇒ Object
448 449 450 |
# File 'lib/knj/http2.rb', line 448 def charset return @args[:charset] end |
#code ⇒ Object
436 437 438 |
# File 'lib/knj/http2.rb', line 436 def code return @args[:code] end |
#contenttype ⇒ Object
452 453 454 |
# File 'lib/knj/http2.rb', line 452 def contenttype return @args[:contenttype] end |
#header(key) ⇒ Object
426 427 428 429 |
# File 'lib/knj/http2.rb', line 426 def header(key) return false if !@args[:headers].key?(key) return @args[:headers][key].first.to_s end |
#header?(key) ⇒ Boolean
431 432 433 434 |
# File 'lib/knj/http2.rb', line 431 def header?(key) return true if @args[:headers].key?(key) and @args[:headers][key].first.to_s.length > 0 return false end |
#headers ⇒ Object
422 423 424 |
# File 'lib/knj/http2.rb', line 422 def headers return @args[:headers] end |
#http_version ⇒ Object
440 441 442 |
# File 'lib/knj/http2.rb', line 440 def http_version return @args[:http_version] end |