Returns an array of nodes matching a given XPath
.
Matches this template against tuple
. The tuple
must be the same size as the template. An element with a nil
value in a template acts as a wildcard, matching any value in the corresponding position in the tuple. Elements of the template match the tuple
if the are ==
or ===
.
Template.new([:foo, 5]).match Tuple.new([:foo, 5]) # => true Template.new([:foo, nil]).match Tuple.new([:foo, 5]) # => true Template.new([String]).match Tuple.new(['hello']) # => true Template.new([:foo]).match Tuple.new([:foo, 5]) # => false Template.new([:foo, 6]).match Tuple.new([:foo, 5]) # => false Template.new([:foo, nil]).match Tuple.new([:foo]) # => false Template.new([:foo, 6]).match Tuple.new([:foo]) # => false
Matches this TemplateEntry
against tuple
. See Template#match
for details on how a Template
matches a Tuple
.
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
[: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"
If you give multiple description strings, each string will be printed line by line.
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 two element array which contains the minimum and the maximum value in the array.
Can be given an optional block to override the default comparison method a <=> b
.
Returns a hash of parsed elements.
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.
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 ...>
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.
This method is equivalent to strftime(‘%F’).