aboutsummaryrefslogtreecommitdiffstats
path: root/lib/plum/client/legacy_client_session.rb
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2016-05-08 02:01:11 +0900
committerKazuki Yamaguchi <k@rhe.jp>2016-05-08 15:17:15 +0900
commit30a6b4df628937e4905b5932d4e43e1708332b62 (patch)
treea77adc1c538f78918376ff126182969bcddbe49f /lib/plum/client/legacy_client_session.rb
parent4e67368773d4343ea953518f26af92110e4ccd2d (diff)
downloadplum-30a6b4df628937e4905b5932d4e43e1708332b62.tar.gz
client: make Response's internal methods private
And use Object#send to call them. Since they are internal, there should be no problem.
Diffstat (limited to 'lib/plum/client/legacy_client_session.rb')
-rw-r--r--lib/plum/client/legacy_client_session.rb9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/plum/client/legacy_client_session.rb b/lib/plum/client/legacy_client_session.rb
index bc531ac..166c0ef 100644
--- a/lib/plum/client/legacy_client_session.rb
+++ b/lib/plum/client/legacy_client_session.rb
@@ -26,7 +26,7 @@ module Plum
def close
@closed = true
- @response._fail if @response
+ @response.send(:fail) if @response
end
def request(headers, body, options, &headers_cb)
@@ -95,17 +95,18 @@ module Plum
def setup_parser
parser = HTTP::Parser.new
parser.on_headers_complete = proc {
+ # FIXME: duplicate header name?
resp_headers = parser.headers.map { |key, value| [key.downcase, value] }.to_h
- @response._headers({ ":status" => parser.status_code.to_s }.merge(resp_headers))
+ @response.send(:set_headers, { ":status" => parser.status_code.to_s }.merge(resp_headers))
@headers_callback.call(@response) if @headers_callback
}
parser.on_body = proc { |chunk|
- @response._chunk(chunk)
+ @response.send(:add_chunk, chunk)
}
parser.on_message_complete = proc { |env|
- @response._finish
+ @response.send(:finish)
@response = nil
@headers_callback = nil
close unless parser.keep_alive?