Calls superclass method.
Returns a duplicate of self
, in column mode (see Column Mode):
source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" table = CSV.parse(source, headers: true) table.mode # => :col_or_row dup_table = table.by_col dup_table.mode # => :col dup_table.equal?(table) # => false # It's a dup
This may be used to chain method calls without changing the mode (but also will affect performance and memory usage):
dup_table.by_col['Name']
Also note that changes to the duplicate table will not affect the original.
Sets the mode for self
to column mode (see Column Mode); returns self
:
source = "Name,Value\nfoo,0\nbar,1\nbaz,2\n" table = CSV.parse(source, headers: true) table.mode # => :col_or_row table1 = table.by_col! table.mode # => :col table1.equal?(table) # => true # Returned self
Stop this server.
Posts data to a host; returns a Net::HTTPResponse
object.
Argument url
must be a URI
; argument data
must be a hash:
_uri = uri.dup _uri.path = '/posts' data = {title: 'foo', body: 'bar', userId: 1} res = Net::HTTP.post_form(_uri, data) # => #<Net::HTTPCreated 201 Created readbody=true> puts res.body
Output:
{ "title": "foo", "body": "bar", "userId": "1", "id": 101 }
Sets the encoding that should be used when reading the body:
If the given value is an Encoding
object, that encoding will be used.
Otherwise if the value is a string, the value of Encoding#find(value) will be used.
Otherwise an encoding will be deduced from the body itself.
Examples:
http = Net::HTTP.new(hostname) req = Net::HTTP::Get.new('/') http.request(req) do |res| p res.body.encoding # => #<Encoding:ASCII-8BIT> end http.request(req) do |res| res.body_encoding = "UTF-8" p res.body.encoding # => #<Encoding:UTF-8> end
Validates typecode v
, returns true
or false
.
Iterates over each option, passing the option to the block
.
Dispatches a single event for ‘node` to all registered listeners.
def dispatch_once
: (Node
) -> void
def comment_targets
: () -> Array[Node | Location]
def comment_targets
: () -> Array[Node | Location]
def comment_targets
: () -> Array[Node | Location]
def comment_targets
: () -> Array[Node | Location]
def comment_targets
: () -> Array[Node | Location]