If the access mode is :row
or :col_or_row
, and each argument is either an Integer or a Range, returns rows. Otherwise, returns columns data.
In either case, the returned values are in the order specified by the arguments. Arguments may be repeated.
Returns rows as an Array of CSV::Row objects.
No argument:
source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" table = CSV.parse(source, headers: true) table.values_at # => []
One index:
values = table.values_at(0) values # => [#<CSV::Row "Name":"foo" "Value":"0">]
Two indexes:
values = table.values_at(2, 0) values # => [#<CSV::Row "Name":"baz" "Value":"2">, #<CSV::Row "Name":"foo" "Value":"0">]
One Range:
values = table.values_at(1..2) values # => [#<CSV::Row "Name":"bar" "Value":"1">, #<CSV::Row "Name":"baz" "Value":"2">]
Ranges and indexes:
values = table.values_at(0..1, 1..2, 0, 2) pp values
Output:
[#<CSV::Row "Name":"foo" "Value":"0">, #<CSV::Row "Name":"bar" "Value":"1">, #<CSV::Row "Name":"bar" "Value":"1">, #<CSV::Row "Name":"baz" "Value":"2">, #<CSV::Row "Name":"foo" "Value":"0">, #<CSV::Row "Name":"baz" "Value":"2">]
Returns columns data as row Arrays, each consisting of the specified columns data for that row:
values = table.values_at('Name') values # => [["foo"], ["bar"], ["baz"]] values = table.values_at('Value', 'Name') values # => [["0", "foo"], ["1", "bar"], ["2", "baz"]]
Returns a human readable string that contains corrections
. This formatter is designed to be less verbose to not take too much screen space while being helpful enough to the user.
@example
formatter = DidYouMean::Formatter.new # displays suggestions in two lines with the leading empty line puts formatter.message_for(["methods", "method"]) Did you mean? methods method # => nil # displays an empty line puts formatter.message_for([]) # => nil
Returns a human readable string that contains corrections
. This formatter is designed to be less verbose to not take too much screen space while being helpful enough to the user.
@example
formatter = DidYouMean::Formatter.new # displays suggestions in two lines with the leading empty line puts formatter.message_for(["methods", "method"]) Did you mean? methods method # => nil # displays an empty line puts formatter.message_for([]) # => nil
Returns a human readable string that contains corrections
. This formatter is designed to be less verbose to not take too much screen space while being helpful enough to the user.
@example
formatter = DidYouMean::Formatter.new # displays suggestions in two lines with the leading empty line puts formatter.message_for(["methods", "method"]) Did you mean? methods method # => nil # displays an empty line puts formatter.message_for([]) # => nil
Creates a DRb::DRbObject
given the reference information to the remote host uri
and object ref
.
Creates a DRb::DRbObject
given the reference information to the remote host uri
and object ref
.
Sets the read timeout, in seconds, for self
to integer sec
; the initial value is 60.
Argument sec
must be a non-negative numeric value:
http = Net::HTTP.new(hostname) http.read_timeout # => 60 http.get('/todos/1') # => #<Net::HTTPOK 200 OK readbody=true> http.read_timeout = 0 http.get('/todos/1') # Raises Net::ReadTimeout.
Sets the write timeout, in seconds, for self
to integer sec
; the initial value is 60.
Argument sec
must be a non-negative numeric value:
_uri = uri.dup _uri.path = '/posts' body = 'bar' * 200000 data = <<EOF {"title": "foo", "body": "#{body}", "userId": "1"} EOF headers = {'content-type': 'application/json'} http = Net::HTTP.new(hostname) http.write_timeout # => 60 http.post(_uri.path, data, headers) # => #<Net::HTTPCreated 201 Created readbody=true> http.write_timeout = 0 http.post(_uri.path, data, headers) # Raises Net::WriteTimeout.
Sets the continue timeout value, which is the number of seconds to wait for an expected 100 Continue response. If the HTTP object does not receive a response in this many seconds it sends the request body.
Returns the password of the proxy server, if defined, nil
otherwise; see Proxy Server.