Results for: "strip"

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 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.
No documentation available

Sends a GET request to the server; forms the response into a Net::HTTPResponse object.

The request is based on the Net::HTTP::Get object created from string path and initial headers hash initheader.

With no block given, returns the response object:

http = Net::HTTP.new(hostname)
http.request_get('/todos') # => #<Net::HTTPOK 200 OK readbody=true>

With a block given, calls the block with the response object and returns the response object:

http.request_get('/todos') do |res|
  p res
end # => #<Net::HTTPOK 200 OK readbody=true>

Output:

#<Net::HTTPOK 200 OK readbody=false>

Sends a HEAD request to the server; returns an instance of a subclass of Net::HTTPResponse.

The request is based on the Net::HTTP::Head object created from string path and initial headers hash initheader.

http = Net::HTTP.new(hostname)
http.head('/todos/1') # => #<Net::HTTPOK 200 OK readbody=true>

Sends an HTTP request to the server; returns an instance of a subclass of Net::HTTPResponse.

The request is based on the Net::HTTPRequest object created from string path, string data, and initial headers hash header. That object is an instance of the subclass of Net::HTTPRequest, that corresponds to the given uppercase string name, which must be an HTTP request method or a WebDAV request method.

Examples:

http = Net::HTTP.new(hostname)
http.send_request('GET', '/todos/1')
# => #<Net::HTTPOK 200 OK readbody=true>
http.send_request('POST', '/todos', 'xyzzy')
# => #<Net::HTTPCreated 201 Created readbody=true>
No documentation available
No documentation available
No documentation available

The start offset of the node in the source. This method is effectively a delegate method to the location object.

Similar to inspect, but respects the current level of indentation given by the pretty print object.

def variable_call?: () -> bool

def variable_call?: () -> bool

def variable_call?: () -> bool

def variable_call?: () -> bool

def variable_call?: () -> bool

def inheritance_operator: () -> String?

def variable_call?: () -> bool

def variable_call?: () -> bool

def variable_call?: () -> bool

def variable_call?: () -> bool

def experimental_everything?: () -> bool

def experimental_copy?: () -> bool

Return the byte offset of the start of the line corresponding to the given byte offset.

These are the comments that are associated with this location that exist after the end of this location.

Search took: 5ms  ·  Total Results: 2417