Results for: "tally"

Return an array of IndexSpecification objects matching DependencyRequest req.

Returns an array of IndexSpecification objects matching DependencyRequest req.

No documentation available

Returns an Array of IndexSpecification objects matching the DependencyRequest req.

The find_all method must be implemented. It returns all Resolver Specification objects matching the given DependencyRequest req.

Returns an Array of VendorSpecification objects matching the DependencyRequest req.

Returns a new array formed from self with elements rotated from one end to the other.

With non-negative numeric count, rotates elements from the beginning to the end:

[0, 1, 2, 3].rotate(2)   # => [2, 3, 0, 1]
[0, 1, 2, 3].rotate(2.1) # => [2, 3, 0, 1]

If count is large, uses count % array.size as the count:

[0, 1, 2, 3].rotate(22) # => [2, 3, 0, 1]

With a count of zero, rotates no elements:

[0, 1, 2, 3].rotate(0) # => [0, 1, 2, 3]

With negative numeric count, rotates in the opposite direction, from the end to the beginning:

[0, 1, 2, 3].rotate(-1) # => [3, 0, 1, 2]

If count is small (far from zero), uses count % array.size as the count:

[0, 1, 2, 3].rotate(-21) # => [3, 0, 1, 2]

Related: see Methods for Fetching.

Rotates self in place by moving elements from one end to the other; returns self.

With non-negative numeric count, rotates count elements from the beginning to the end:

[0, 1, 2, 3].rotate!(2)   # => [2, 3, 0, 1]
[0, 1, 2, 3].rotate!(2.1) # => [2, 3, 0, 1]

If count is large, uses count % array.size as the count:

[0, 1, 2, 3].rotate!(21) # => [1, 2, 3, 0]

If count is zero, rotates no elements:

[0, 1, 2, 3].rotate!(0) # => [0, 1, 2, 3]

With a negative numeric count, rotates in the opposite direction, from end to beginning:

[0, 1, 2, 3].rotate!(-1) # => [3, 0, 1, 2]

If count is small (far from zero), uses count % array.size as the count:

[0, 1, 2, 3].rotate!(-21) # => [3, 0, 1, 2]

Related: see Methods for Assigning.

With a block given, calls the block with each element of self; returns a new array whose elements are the return values from the block:

a = [:foo, 'bar', 2]
a1 = a.map {|element| element.class }
a1 # => [Symbol, String, Integer]

With no block given, returns a new Enumerator.

Related: collect!; see also Methods for Converting.

With a block given, calls the block with each element of self and replaces the element with the block’s return value; returns self:

a = [:foo, 'bar', 2]
a.map! { |element| element.class } # => [Symbol, String, Integer]

With no block given, returns a new Enumerator.

Related: collect; see also Methods for Converting.

Replaces selected elements in self; may add elements to self; always returns self (never a new array).

In brief:

# Non-negative start.
['a', 'b', 'c', 'd'].fill('-', 1, 2)          # => ["a", "-", "-", "d"]
['a', 'b', 'c', 'd'].fill(1, 2) {|e| e.to_s } # => ["a", "1", "2", "d"]

# Extends with specified values if necessary.
['a', 'b', 'c', 'd'].fill('-', 3, 2)          # => ["a", "b", "c", "-", "-"]
['a', 'b', 'c', 'd'].fill(3, 2) {|e| e.to_s } # => ["a", "b", "c", "3", "4"]

# Fills with nils if necessary.
['a', 'b', 'c', 'd'].fill('-', 6, 2)          # => ["a", "b", "c", "d", nil, nil, "-", "-"]
['a', 'b', 'c', 'd'].fill(6, 2) {|e| e.to_s } # => ["a", "b", "c", "d", nil, nil, "6", "7"]

# For negative start, counts backwards from the end.
['a', 'b', 'c', 'd'].fill('-', -3, 3)          # => ["a", "-", "-", "-"]
['a', 'b', 'c', 'd'].fill(-3, 3) {|e| e.to_s } # => ["a", "1", "2", "3"]

# Range.
['a', 'b', 'c', 'd'].fill('-', 1..2)          # => ["a", "-", "-", "d"]
['a', 'b', 'c', 'd'].fill(1..2) {|e| e.to_s } # => ["a", "1", "2", "d"]

When arguments start and count are given, they select the elements of self to be replaced; each must be an integer-convertible object (or nil):

With argument object given, that one object is used for all replacements:

o = Object.new           # => #<Object:0x0000014e7bff7600>
a = ['a', 'b', 'c', 'd'] # => ["a", "b", "c", "d"]
a.fill(o, 1, 2)
# => ["a", #<Object:0x0000014e7bff7600>, #<Object:0x0000014e7bff7600>, "d"]

With a block given, the block is called once for each element to be replaced; the value passed to the block is the index of the element to be replaced (not the element itself); the block’s return value replaces the element:

a = ['a', 'b', 'c', 'd']               # => ["a", "b", "c", "d"]
a.fill(1, 2) {|element| element.to_s } # => ["a", "1", "2", "d"]

For arguments start and count:

When argument range is given, it must be a Range object whose members are numeric; its begin and end values determine the elements of self to be replaced:

Related: see Methods for Assigning.

Iterates over permutations of the elements of self; the order of permutations is indeterminate.

With a block and an in-range positive integer argument count (0 < count <= self.size) given, calls the block with each permutation of self of size count; returns self:

a = [0, 1, 2]
perms = []
a.permutation(1) {|perm| perms.push(perm) }
perms # => [[0], [1], [2]]

perms = []
a.permutation(2) {|perm| perms.push(perm) }
perms # => [[0, 1], [0, 2], [1, 0], [1, 2], [2, 0], [2, 1]]

perms = []
a.permutation(3) {|perm| perms.push(perm) }
perms # => [[0, 1, 2], [0, 2, 1], [1, 0, 2], [1, 2, 0], [2, 0, 1], [2, 1, 0]]

When count is zero, calls the block once with a new empty array:

perms = []
a.permutation(0) {|perm| perms.push(perm) }
perms # => [[]]

When count is out of range (negative or larger than self.size), does not call the block:

a.permutation(-1) {|permutation| fail 'Cannot happen' }
a.permutation(4) {|permutation| fail 'Cannot happen' }

With no block given, returns a new Enumerator.

Related: Methods for Iterating.

Returns a new array containing the first count element of self (as available); count must be a non-negative numeric; does not modify self:

a = ['a', 'b', 'c', 'd']
a.take(2)   # => ["a", "b"]
a.take(2.1) # => ["a", "b"]
a.take(50)  # => ["a", "b", "c", "d"]
a.take(0)   # => []

Related: see Methods for Fetching.

Builds a command line string from an argument list array joining all elements escaped for the Bourne shell and separated by a space.

See Shellwords.shelljoin for details.

Returns a Hash containing implementation-dependent counters inside the VM.

This hash includes information about method/constant caches:

{
  :constant_cache_invalidations=>2,
  :constant_cache_misses=>14,
  :global_cvar_state=>27
}

If USE_DEBUG_COUNTER is enabled, debug counters will be included.

The contents of the hash are implementation specific and may be changed in the future.

This method is only expected to work on C Ruby.

Returns the value as a rational. The optional argument eps is always ignored.

Return the class or module refined by the receiver.

module M
  refine String do
  end
end

M.refinements[0].target # => String

Returns a new Complex object formed from the arguments, each of which must be an instance of Numeric, or an instance of one of its subclasses: Complex, Float, Integer, Rational; see Rectangular Coordinates:

Complex.rect(3)             # => (3+0i)
Complex.rect(3, Math::PI)   # => (3+3.141592653589793i)
Complex.rect(-3, -Math::PI) # => (-3-3.141592653589793i)

Complex.rectangular is an alias for Complex.rect.

Returns the real value for self:

Complex.rect(7).real     # => 7
Complex.rect(9, -4).real # => 9

If self was created with polar coordinates, the returned value is computed, and may be inexact:

Complex.polar(1, Math::PI/4).real # => 0.7071067811865476 # Square root of 2.

Returns the array [self.real, self.imag]:

Complex.rect(1, 2).rect # => [1, 2]

See Rectangular Coordinates.

If self was created with polar coordinates, the returned value is computed, and may be inexact:

Complex.polar(1.0, 1.0).rect # => [0.5403023058681398, 0.8414709848078965]

Complex#rectangular is an alias for Complex#rect.

Returns false; for compatibility with Numeric#real?.

Returns a Rational object whose value is exactly or approximately equivalent to that of self.real.

With no argument epsilon given, returns a Rational object whose value is exactly equal to that of self.real.rationalize:

Complex.rect(1, 0).rationalize              # => (1/1)
Complex.rect(1, Rational(0, 1)).rationalize # => (1/1)
Complex.rect(3.14159, 0).rationalize        # => (314159/100000)

With argument epsilon given, returns a Rational object whose value is exactly or approximately equal to that of self.real to the given precision:

Complex.rect(3.14159, 0).rationalize(0.1)          # => (16/5)
Complex.rect(3.14159, 0).rationalize(0.01)         # => (22/7)
Complex.rect(3.14159, 0).rationalize(0.001)        # => (201/64)
Complex.rect(3.14159, 0).rationalize(0.0001)       # => (333/106)
Complex.rect(3.14159, 0).rationalize(0.00001)      # => (355/113)
Complex.rect(3.14159, 0).rationalize(0.000001)     # => (7433/2366)
Complex.rect(3.14159, 0).rationalize(0.0000001)    # => (9208/2931)
Complex.rect(3.14159, 0).rationalize(0.00000001)   # => (47460/15107)
Complex.rect(3.14159, 0).rationalize(0.000000001)  # => (76149/24239)
Complex.rect(3.14159, 0).rationalize(0.0000000001) # => (314159/100000)
Complex.rect(3.14159, 0).rationalize(0.0)          # => (3537115888337719/1125899906842624)

Related: Complex#to_r.

Returns zero as a Rational:

nil.rationalize # => (0/1)

Argument eps is ignored.

Returns array [self, 0].

Returns true if self is a real number (i.e. not Complex).

Search took: 2ms  ·  Total Results: 1908