Returns the change time for stat (that is, the time directory information about the file was changed, not the file itself).
Note that on Windows (NTFS), returns creation time (birth time).
File.stat("testfile").ctime #=> Wed Apr 09 08:53:14 CDT 2003
Returns true
if stat has its sticky bit set, false
if it doesn’t or if the operating system doesn’t support this feature.
File.stat("testfile").sticky? #=> false
Parse a raw cookie string into a hash of cookie-name=>Cookie pairs.
cookies = CGI::Cookie.parse("raw_cookie_string") # { "name1" => cookie1, "name2" => cookie2, ... }
Returns true
; retained for compatibility.
Creates a new Net::HTTP object, http
, via Net::HTTP.new:
For arguments address
and port
, see Net::HTTP.new
.
For proxy-defining arguments p_addr
through p_pass
, see Proxy Server.
For argument opts
, see below.
With no block given:
Calls http.start
with no block (see start
), which opens a TCP connection and HTTP session.
Returns http
.
The caller should call finish
to close the session:
http = Net::HTTP.start(hostname) http.started? # => true http.finish http.started? # => false
With a block given:
Calls http.start
with the block (see start
), which:
Opens a TCP connection and HTTP session.
Calls the block, which may make any number of requests to the host.
Closes the HTTP session and TCP connection on block exit.
Returns the block’s value object
.
Returns object
.
Example:
hostname = 'jsonplaceholder.typicode.com' Net::HTTP.start(hostname) do |http| puts http.get('/todos/1').body puts http.get('/todos/2').body end
Output:
{ "userId": 1, "id": 1, "title": "delectus aut autem", "completed": false } { "userId": 1, "id": 2, "title": "quis ut nam facilis et officia qui", "completed": false }
If the last argument given is a hash, it is the opts
hash, where each key is a method or accessor to be called, and its value is the value to be set.
The keys may include:
Note: If port
is nil
and opts[:use_ssl]
is a truthy value, the value passed to new
is Net::HTTP.https_default_port
, not port
.
Returns true
if the HTTP session has been started:
http = Net::HTTP.new(hostname) http.started? # => false http.start http.started? # => true http.finish # => nil http.started? # => false Net::HTTP.start(hostname) do |http| http.started? end # => true http.started? # => false
Starts an HTTP session.
Without a block, returns self
:
http = Net::HTTP.new(hostname) # => #<Net::HTTP jsonplaceholder.typicode.com:80 open=false> http.start # => #<Net::HTTP jsonplaceholder.typicode.com:80 open=true> http.started? # => true http.finish
With a block, calls the block with self
, finishes the session when the block exits, and returns the block’s value:
http.start do |http| http end # => #<Net::HTTP jsonplaceholder.typicode.com:80 open=false> http.started? # => false
Returns true
; retained for compatibility.
Creates a new Net::HTTP object, http
, via Net::HTTP.new:
For arguments address
and port
, see Net::HTTP.new
.
For proxy-defining arguments p_addr
through p_pass
, see Proxy Server.
For argument opts
, see below.
With no block given:
Calls http.start
with no block (see start
), which opens a TCP connection and HTTP session.
Returns http
.
The caller should call finish
to close the session:
http = Net::HTTP.start(hostname) http.started? # => true http.finish http.started? # => false
With a block given:
Calls http.start
with the block (see start
), which:
Opens a TCP connection and HTTP session.
Calls the block, which may make any number of requests to the host.
Closes the HTTP session and TCP connection on block exit.
Returns the block’s value object
.
Returns object
.
Example:
hostname = 'jsonplaceholder.typicode.com' Net::HTTP.start(hostname) do |http| puts http.get('/todos/1').body puts http.get('/todos/2').body end
Output:
{ "userId": 1, "id": 1, "title": "delectus aut autem", "completed": false } { "userId": 1, "id": 2, "title": "quis ut nam facilis et officia qui", "completed": false }
If the last argument given is a hash, it is the opts
hash, where each key is a method or accessor to be called, and its value is the value to be set.
The keys may include:
Note: If port
is nil
and opts[:use_ssl]
is a truthy value, the value passed to new
is Net::HTTP.https_default_port
, not port
.
Returns true
if the HTTP session has been started:
http = Net::HTTP.new(hostname) http.started? # => false http.start http.started? # => true http.finish # => nil http.started? # => false Net::HTTP.start(hostname) do |http| http.started? end # => true http.started? # => false
Starts an HTTP session.
Without a block, returns self
:
http = Net::HTTP.new(hostname) # => #<Net::HTTP jsonplaceholder.typicode.com:80 open=false> http.start # => #<Net::HTTP jsonplaceholder.typicode.com:80 open=true> http.started? # => true http.finish
With a block, calls the block with self
, finishes the session when the block exits, and returns the block’s value:
http.start do |http| http end # => #<Net::HTTP jsonplaceholder.typicode.com:80 open=false> http.started? # => false
def lparen: () -> String
?
def rparen: () -> String
?
def lparen: () -> String
?
def rparen: () -> String
?
def lparen: () -> String
?
def rparen: () -> String
?
def lparen: () -> String
?
def rparen: () -> String
?
def lparen: () -> String
def rparen: () -> String
def lparen: () -> String
?
def rparen: () -> String
?
def lparen: () -> String
?