Indicate if this NameTuple
matches the current platform.
Set
date-time format.
datetime_format
A string suitable for passing to strftime
.
Returns the date format being used. See datetime_format=
Creates an OptionParser::Switch
from the parameters. The parsed argument value is passed to the given block, where it can be processed.
See at the beginning of OptionParser
for some full examples.
opts
can include the following elements:
One of the following:
:NONE, :REQUIRED, :OPTIONAL
Acceptable option argument format, must be pre-defined with OptionParser.accept
or OptionParser#accept
, or Regexp
. This can appear once or assigned as String if not present, otherwise causes an ArgumentError
. Examples:
Float, Time, Array
Hash
or Array.
[:text, :binary, :auto] %w[iso-2022-jp shift_jis euc-jp utf8 binary] { "jis" => "iso-2022-jp", "sjis" => "shift_jis" }
Specifies a long style switch which takes a mandatory, optional or no argument. It’s a string of the following form:
"--switch=MANDATORY" or "--switch MANDATORY" "--switch[=OPTIONAL]" "--switch"
Specifies short style switch which takes a mandatory, optional or no argument. It’s a string of the following form:
"-xMANDATORY" "-x[OPTIONAL]" "-x"
There is also a special form which matches character range (not full set of regular expression):
"-[a-z]MANDATORY" "-[a-z][OPTIONAL]" "-[a-z]"
Instead of specifying mandatory or optional arguments directly in the switch parameter, this separate parameter can be used.
"=MANDATORY" "=[OPTIONAL]"
Description string for the option.
"Run verbosely"
Handler for the parsed argument value. Either give a block or pass a Proc
or Method
as an argument.
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 path
and gets a response, as an HTTPResponse
object.
Sends a PROPPATCH request to the path
and gets a response, as an HTTPResponse
object.
Tries to return the element at position index
, but throws an IndexError
exception if the referenced index
lies outside of the array bounds. This error can be prevented by supplying a second argument, which will act as a default
value.
Alternatively, if a block is given it will only be executed when an invalid index
is referenced.
Negative values of index
count from the end of the array.
a = [ 11, 22, 33, 44 ] a.fetch(1) #=> 22 a.fetch(-1) #=> 44 a.fetch(4, 'cat') #=> "cat" a.fetch(100) { |i| puts "#{i} is out of bounds" } #=> "100 is out of bounds"
Returns a hash of parsed elements.
Creates a new Date
object by parsing from a string according to some typical XML
Schema formats.
Date.xmlschema('2001-02-03') #=> #<Date: 2001-02-03 ...>
This method is equivalent to strftime(‘%F’).
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 ...>
This method is equivalent to strftime(‘%FT%T%:z’). The optional argument n
is the number of digits for fractional seconds.
DateTime.parse('2001-02-03T04:05:06.123456789+07:00').iso8601(9) #=> "2001-02-03T04:05:06.123456789+07:00"
Parses date
as a dateTime defined by the XML
Schema and converts it to a Time
object. The format is a restricted version of the format defined by ISO 8601.
ArgumentError
is raised if date
is not compliant with the format or if the Time
class cannot represent specified date.
See xmlschema
for more information on this format.
You must require ‘time’ to use this method.
Returns a string which represents the time as a dateTime defined by XML
Schema:
CCYY-MM-DDThh:mm:ssTZD CCYY-MM-DDThh:mm:ss.sssTZD
where TZD is Z or [+-]hh:mm.
If self is a UTC time, Z is used as TZD. [+-]hh:mm is used otherwise.
fractional_digits
specifies a number of digits to use for fractional seconds. Its default value is 0.
You must require ‘time’ to use this method.
Return a value from the database by locating the key string provided. If the key is not found, returns ifnone
. If ifnone
is not given, raises IndexError
.
Reads and returns a character in raw mode.
See IO#raw
for details on the parameters.
You must require ‘io/console’ to use this method.