Create a new CaseMatchNode
node
Create a new MatchLastLineNode
node
Create a new MatchRequiredNode
node
Create a new MatchWriteNode
node
Indicate if this NameTuple
matches the current platform.
Sets the date-time format.
Argument datetime_format
should be either of these:
A string suitable for use as a format for method Time#strftime
.
nil
: the logger uses '%Y-%m-%dT%H:%M:%S.%6N'
.
Returns the date-time format; see datetime_format=
.
Creates an option from the given parameters params
. See Parameters for New Options.
The block, if given, is the handler for the created option. When the option is encountered during command-line parsing, the block is called with the argument given for the option, if any. See Option Handlers.
Does this dependency match spec
?
NOTE: This is not a convenience method. Unlike match?
this method returns true when spec
is a prerelease version even if this dependency is not a prerelease dependency.
Sends a PATCH request to the server; returns an instance of a subclass of Net::HTTPResponse
.
The request is based on the Net::HTTP::Patch
object created from string path
, string data
, and initial headers hash initheader
.
With a block given, calls the block with the response body:
data = '{"userId": 1, "id": 1, "title": "delectus aut autem", "completed": false}' http = Net::HTTP.new(hostname) http.patch('/todos/1', data) do |res| p res end # => #<Net::HTTPOK 200 OK readbody=true>
Output:
"{\n \"userId\": 1,\n \"id\": 1,\n \"title\": \"delectus aut autem\",\n \"completed\": false,\n \"{\\\"userId\\\": 1, \\\"id\\\": 1, \\\"title\\\": \\\"delectus aut autem\\\", \\\"completed\\\": false}\": \"\"\n}"
With no block given, simply returns the response object:
http.patch('/todos/1', data) # => #<Net::HTTPCreated 201 Created readbody=true>
Sends a PROPPATCH request to the server; returns an instance of a subclass of Net::HTTPResponse
.
The request is based on the Net::HTTP::Proppatch
object created from string path
, string body
, and initial headers hash initheader
.
data = '{"userId": 1, "id": 1, "title": "delectus aut autem", "completed": false}' http = Net::HTTP.new(hostname) http.proppatch('/todos/1', data)
Returns the element at offset index
.
With the single Integer
argument index
, returns the element at offset index
:
a = [:foo, 'bar', 2] a.fetch(1) # => "bar"
If index
is negative, counts from the end of the array:
a = [:foo, 'bar', 2] a.fetch(-1) # => 2 a.fetch(-2) # => "bar"
With arguments index
and default_value
, returns the element at offset index
if index is in range, otherwise returns default_value
:
a = [:foo, 'bar', 2] a.fetch(1, nil) # => "bar"
With argument index
and a block, returns the element at offset index
if index is in range (and the block is not called); otherwise calls the block with index and returns its return value:
a = [:foo, 'bar', 2] a.fetch(1) {|index| raise 'Cannot happen' } # => "bar" a.fetch(50) {|index| "Value for #{index}" } # => "Value for 50"
Returns a new 2-element Array
containing the minimum and maximum values from self
, either per method <=>
or per a given block:.
When no block is given, each element in self
must respond to method <=>
with an Integer
; returns a new 2-element Array
containing the minimum and maximum values from self
, per method <=>
:
[0, 1, 2].minmax # => [0, 2]
When a block is given, the block must return an Integer
; the block is called self.size-1
times to compare elements; returns a new 2-element Array
containing the minimum and maximum values from self
, per the block:
['0', '00', '000'].minmax {|a, b| a.size <=> b.size } # => ["0", "000"]
Returns a hash of values parsed from string
, which should be a valid XML date format:
d = Date.new(2001, 2, 3) s = d.xmlschema # => "2001-02-03" Date._xmlschema(s) # => {:year=>2001, :mon=>2, :mday=>3}
See argument limit.
Related: Date.xmlschema
(returns a Date object).
Returns a new Date object with values parsed from string
, which should be a valid XML date format:
d = Date.new(2001, 2, 3) s = d.xmlschema # => "2001-02-03" Date.xmlschema(s) # => #<Date: 2001-02-03>
See:
Argument start.
Argument limit.
Related: Date._xmlschema
(returns a hash).
Equivalent to strftime
with argument '%Y-%m-%d'
(or its shorthand form '%F'
);
Date.new(2001, 2, 3).iso8601 # => "2001-02-03"
Creates a new DateTime
object by parsing from a string according to some typical XML Schema formats.
DateTime.xmlschema('2001-02-03T04:05:06+07:00') #=> #<DateTime: 2001-02-03T04:05:06+07:00 ...>
Raise an ArgumentError
when the string length is longer than limit. You can stop this check by passing limit: nil
, but note that it may take a long time to parse.