Returns a human-readable string representation of this instruction sequence, including the label
and path
.
Set
domain for which this cookie applies
A summary of cookie string.
Returns the index for the given header, if it exists; otherwise returns nil
.
With the single argument header
, returns the index of the first-found field with the given header
:
source = "Name,Name,Name\nFoo,Bar,Baz\n" table = CSV.parse(source, headers: true) row = table[0] row.index('Name') # => 0 row.index('NAME') # => nil
With arguments header
and offset
, returns the index of the first-found field with given header
, but ignoring the first offset
fields:
row.index('Name', 1) # => 1 row.index('Name', 3) # => nil
Returns an ASCII-compatible String showing:
Class
CSV::Row.
Header-value pairs.
Example:
source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" table = CSV.parse(source, headers: true) row = table[0] row.inspect # => "#<CSV::Row \"Name\":\"foo\" \"Value\":\"0\">"
Returns a US-ASCII
-encoded String showing table:
Class: CSV::Table
.
Access mode: :row
, :col
, or :col_or_row
.
Size: Row
count, including the header row.
Example:
source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" table = CSV.parse(source, headers: true) table.inspect # => "#<CSV::Table mode:col_or_row row_count:4>\nName,Value\nfoo,0\nbar,1\nbaz,2\n"
Winds back to the beginning
Get the URI
of the remote object.
Get the URI
of the remote object.
Posts data to the specified URI
object.
Example:
require 'net/http' require 'uri' Net::HTTP.post URI('http://www.example.com/api/search'), { "q" => "ruby", "max" => "50" }.to_json, "Content-Type" => "application/json"
Creates a new Net::HTTP
object, then additionally opens the TCP connection and HTTP
session.
Arguments are the following:
hostname or IP address of the server
port of the server
address of proxy
port of proxy
user of proxy
pass of proxy
optional hash
opt sets following values by its accessor. The keys are ipaddr, ca_file
, ca_path
, cert, cert_store
, ciphers, keep_alive_timeout
, close_on_empty_response
, key, open_timeout
, read_timeout
, write_timeout
, ssl_timeout
, ssl_version
, use_ssl, verify_callback
, verify_depth
and verify_mode. If you set :use_ssl as true, you can use https and default value of verify_mode
is set as OpenSSL::SSL::VERIFY_PEER.
If the optional block is given, the newly created Net::HTTP
object is passed to it and closed when the block finishes. In this case, the return value of this method is the return value of the block. If no block is given, the return value of this method is the newly created Net::HTTP
object itself, and the caller is responsible for closing it upon completion using the finish() method.
Returns true if the HTTP
session has been started.
Opens a TCP connection and HTTP
session.
When this method is called with a block, it passes the Net::HTTP
object to the block, and closes the TCP connection and HTTP
session after the block has been executed.
When called with a block, it returns the return value of the block; otherwise, it returns self.
Finishes the HTTP
session and closes the TCP connection. Raises IOError
if the session has not been started.
Posts data
(must be a String
) to path
. header
must be a Hash
like { ‘Accept’ => ‘/’, … }.
This method returns a Net::HTTPResponse
object.
If called with a block, yields each fragment of the entity body in turn as a string as it is read from the socket. Note that in this case, the returned response object will not contain a (meaningful) body.
dest
argument is obsolete. It still works but you must not use it.
This method never raises exception.
response = http.post('/cgi-bin/search.rb', 'query=foo') # using block File.open('result.txt', 'w') {|f| http.post('/cgi-bin/search.rb', 'query=foo') do |str| f.write str end }
You should set Content-Type: header field for POST. If no Content-Type: field given, this method uses “application/x-www-form-urlencoded” by default.
Sends a PROPFIND request to the path
and gets a response, as an HTTPResponse
object.
Sends a TRACE request to the path
and gets a response, as an HTTPResponse
object.