Method: Net::HTTP.get_print

Defined in:
lib/net/http.rb

.get_print(uri_or_host, path_or_headers = nil, port = nil) ⇒ Object

:call-seq:

Net::HTTP.get_print(hostname, path, port = 80) -> nil
Net::HTTP:get_print(uri, headers = {}, port = uri.port) -> nil

Like Net::HTTP.get, but writes the returned body to $stdout; returns nil.



763
764
765
766
767
768
769
770
# File 'lib/net/http.rb', line 763

def HTTP.get_print(uri_or_host, path_or_headers = nil, port = nil)
  get_response(uri_or_host, path_or_headers, port) {|res|
    res.read_body do |chunk|
      $stdout.print chunk
    end
  }
  nil
end