Results for: "fnmatch"

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.

fraction_digits specifies a number of digits to use for fractional seconds. Its default value is 0.

Example
require 'time'

t = Time.now
t.iso8601  # => "2011-10-05T22:26:12-04:00"

You must require ‘time’ to use this method.

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.

Returns a 2-element array containing the minimum and maximum value in self, either according to comparison method #<=> or a given block.

With no block given, returns the minimum and maximum values, using #<=> for comparison:

Example
(1..4).minmax     # => [1, 4]
(1...4).minmax    # => [1, 3]
('a'..'d').minmax # => ["a", "d"]
(-4..-1).minmax   # => [-4, -1]

With a block given, the block must return an integer:

The block is called self.size times to compare elements; returns a 2-element Array containing the minimum and maximum values from self, per the block:

Example
(1..4).minmax {|a, b| -(a <=> b) } # => [4, 1]

Returns [nil, nil] if:

Raises an exception if self is a beginless or an endless range.

Related: Range#min, Range#max.

No documentation available

Returns the value for the given key, if found.

Example
h = {foo: 0, bar: 1, baz: 2}
h.fetch(:bar) # => 1

If key is not found and no block was given, returns default_value:

Example
{}.fetch(:nosuch, :default) # => :default

If key is not found and a block was given, yields key to the block and returns the block’s return value:

Example
{}.fetch(:nosuch) {|key| "No key #{key}"} # => "No key nosuch"

Raises KeyError if neither default_value nor a block was given.

Note that this method does not use the values of either default or default_proc.

If name is the name of an environment variable, returns its value:

Example
ENV['foo'] = '0'
ENV.fetch('foo') # => '0'

Otherwise if a block is given (but not a default value), yields name to the block and returns the block’s return value:

Example
ENV.fetch('foo') { |name| :need_not_return_a_string } # => :need_not_return_a_string

Otherwise if a default value is given (but not a block), returns the default value:

Example
ENV.delete('foo')
ENV.fetch('foo', :default_need_not_be_a_string) # => :default_need_not_be_a_string

If the environment variable does not exist and both default and block are given, issues a warning (“warning: block supersedes default value argument”), yields name to the block, and returns the block’s return value:

Example
ENV.fetch('foo', :default) { |name| :block_return } # => :block_return

Raises KeyError if name is valid, but not found, and neither default value nor block is given:

Example
ENV.fetch('foo') # Raises KeyError (key not found: "foo")

Raises an exception if name is invalid. See Invalid Names and Values.

This is a convenience method which is same as follows:

Example
begin
  q = PrettyPrint.new(output, maxwidth, newline, &genspace)
  ...
  q.flush
  output
end

Returns a fiber-local for the given key. If the key can’t be found, there are several options: With no other arguments, it will raise a KeyError exception; if default is given, then that will be returned; if the optional code block is specified, then that will be run and its result returned. See Thread#[] and Hash#fetch.

Returns the string resulting from formatting objects into format_string.

For details on format_string, see Format Specifications.

Returns a 2-element array containing the minimum and maximum elements according to a given criterion. The ordering of equal elements is indeterminate and may be unstable.

With no argument and no block, returns the minimum and maximum elements, using the elements’ own method #<=> for comparison:

Example
(1..4).minmax                   # => [1, 4]
(-4..-1).minmax                 # => [-4, -1]
%w[d c b a].minmax              # => ["a", "d"]
{foo: 0, bar: 1, baz: 2}.minmax # => [[:bar, 1], [:foo, 0]]
[].minmax                       # => [nil, nil]

With a block given, returns the minimum and maximum elements as determined by the block:

Example
%w[xxx x xxxx xx].minmax {|a, b| a.size <=> b.size } # => ["x", "xxxx"]
h = {foo: 0, bar: 1, baz: 2}
h.minmax {|pair1, pair2| pair1[1] <=> pair2[1] }
# => [[:foo, 0], [:baz, 2]]
[].minmax {|a, b| a <=> b }                          # => [nil, nil]

Related: min, max, minmax_by.

Returns the currently set formatter. By default, it is set to DidYouMean::Formatter.

Updates the primary formatter used to format the suggestions.

No documentation available
No documentation available

@return [Array] specs of default gems that are ‘==` to the given `spec`.

Return all files in this gem that match for glob.

@return true if the specs of any default gems are ‘==` to the given `spec`.

Does this dependency request match spec?

NOTE: match? only matches prerelease versions when dependency is a prerelease dependency.

No documentation available

Downloads uri and returns it as a String.

A recommended version for use with a ~> Requirement.

@api private

Does this dependency request match spec?

NOTE: matches_spec? matches prerelease versions. See also match?

With a block given, calls the block with each repeated permutation of length size of the elements of self; each permutation is an array; returns self. The order of the permutations is indeterminate.

If a positive integer argument size is given, calls the block with each size-tuple repeated permutation of the elements of self. The number of permutations is self.size**size.

Examples:

If size is zero, calls the block once with an empty array.

If size is negative, does not call the block:

Example
[0, 1, 2].repeated_permutation(-1) {|permutation| fail 'Cannot happen' }

With no block given, returns a new Enumerator.

Related: see Methods for Combining.

With a block given, calls the block with each repeated combination of length size of the elements of self; each combination is an array; returns self. The order of the combinations is indeterminate.

If a positive integer argument size is given, calls the block with each size-tuple repeated combination of the elements of self. The number of combinations is (size+1)(size+2)/2.

Examples:

If size is zero, calls the block once with an empty array.

If size is negative, does not call the block:

Example
[0, 1, 2].repeated_combination(-1) {|combination| fail 'Cannot happen' }

With no block given, returns a new Enumerator.

Related: see Methods for Combining.

Search took: 14ms  ·  Total Results: 1776