Results for: "tally"

No documentation available
No documentation available

Finds all gems that satisfy dep

Shows the context around code provided by “falling” indentation

Converts:

it "foo" do

into:

class OH
  def hello
    it "foo" do
  end
end

Calls the block with each capitalized field name:

res = Net::HTTP.get_response(hostname, '/todos/1')
res.each_capitalized_name do |key|
  p key if key.start_with?('C')
end

Output:

"Content-Type"
"Connection"
"Cache-Control"
"Cf-Cache-Status"
"Cf-Ray"

The capitalization is system-dependent; see Case Mapping.

Returns an enumerator if no block is given.

foo.bar, = 1 ^^^^^^^

No documentation available

Returns all tokens for the input script regardless the receiver node. Returns nil if keep_tokens is not enabled when parse method is called.

root = RubyVM::AbstractSyntaxTree.parse("x = 1 + 2", keep_tokens: true)
root.all_tokens # => [[0, :tIDENTIFIER, "x", [1, 0, 1, 1]], [1, :tSP, " ", [1, 1, 1, 2]], ...]
root.children[-1].all_tokens # => [[0, :tIDENTIFIER, "x", [1, 0, 1, 1]], [1, :tSP, " ", [1, 1, 1, 2]], ...]

General callback for OpenSSL verify

Return an array of APISpecification objects matching DependencyRequest req.

Finds all specs matching req in all sets.

No documentation available

Finds all git gems matching req

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.

When no argument given, returns a new Array that is like self, except that the first element has been rotated to the last position:

a = [:foo, 'bar', 2, 'bar']
a1 = a.rotate
a1 # => ["bar", 2, "bar", :foo]

When given a non-negative Integer count, returns a new Array with count elements rotated from the beginning to the end:

a = [:foo, 'bar', 2]
a1 = a.rotate(2)
a1 # => [2, :foo, "bar"]

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

a = [:foo, 'bar', 2]
a1 = a.rotate(20)
a1 # => [2, :foo, "bar"]

If count is zero, returns a copy of self, unmodified:

a = [:foo, 'bar', 2]
a1 = a.rotate(0)
a1 # => [:foo, "bar", 2]

When given a negative Integer count, rotates in the opposite direction, from end to beginning:

a = [:foo, 'bar', 2]
a1 = a.rotate(-2)
a1 # => ["bar", 2, :foo]

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

a = [:foo, 'bar', 2]
a1 = a.rotate(-5)
a1 # => ["bar", 2, :foo]

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

When no argument given, rotates the first element to the last position:

a = [:foo, 'bar', 2, 'bar']
a.rotate! # => ["bar", 2, "bar", :foo]

When given a non-negative Integer count, rotates count elements from the beginning to the end:

a = [:foo, 'bar', 2]
a.rotate!(2)
a # => [2, :foo, "bar"]

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

a = [:foo, 'bar', 2]
a.rotate!(20)
a # => [2, :foo, "bar"]

If count is zero, returns self unmodified:

a = [:foo, 'bar', 2]
a.rotate!(0)
a # => [:foo, "bar", 2]

When given a negative Integer count, rotates in the opposite direction, from end to beginning:

a = [:foo, 'bar', 2]
a.rotate!(-2)
a # => ["bar", 2, :foo]

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

a = [:foo, 'bar', 2]
a.rotate!(-5)
a # => ["bar", 2, :foo]

Calls the block, if given, 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]

Returns a new Enumerator if no block given:

a = [:foo, 'bar', 2]
a1 = a.map
a1 # => #<Enumerator: [:foo, "bar", 2]:map>

Calls the block, if given, with each element; replaces the element with the block’s return value:

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

Returns a new Enumerator if no block given:

a = [:foo, 'bar', 2]
a1 = a.map!
a1 # => #<Enumerator: [:foo, "bar", 2]:map!>

Replaces specified elements in self with specified objects; returns self.

With argument obj and no block given, replaces all elements with that one object:

a = ['a', 'b', 'c', 'd']
a # => ["a", "b", "c", "d"]
a.fill(:X) # => [:X, :X, :X, :X]

With arguments obj and Integer start, and no block given, replaces elements based on the given start.

If start is in range (0 <= start < array.size), replaces all elements from offset start through the end:

a = ['a', 'b', 'c', 'd']
a.fill(:X, 2) # => ["a", "b", :X, :X]

If start is too large (start >= array.size), does nothing:

a = ['a', 'b', 'c', 'd']
a.fill(:X, 4) # => ["a", "b", "c", "d"]
a = ['a', 'b', 'c', 'd']
a.fill(:X, 5) # => ["a", "b", "c", "d"]

If start is negative, counts from the end (starting index is start + array.size):

a = ['a', 'b', 'c', 'd']
a.fill(:X, -2) # => ["a", "b", :X, :X]

If start is too small (less than and far from zero), replaces all elements:

a = ['a', 'b', 'c', 'd']
a.fill(:X, -6) # => [:X, :X, :X, :X]
a = ['a', 'b', 'c', 'd']
a.fill(:X, -50) # => [:X, :X, :X, :X]

With arguments obj, Integer start, and Integer length, and no block given, replaces elements based on the given start and length.

If start is in range, replaces length elements beginning at offset start:

a = ['a', 'b', 'c', 'd']
a.fill(:X, 1, 1) # => ["a", :X, "c", "d"]

If start is negative, counts from the end:

a = ['a', 'b', 'c', 'd']
a.fill(:X, -2, 1) # => ["a", "b", :X, "d"]

If start is large (start >= array.size), extends self with nil:

a = ['a', 'b', 'c', 'd']
a.fill(:X, 5, 0) # => ["a", "b", "c", "d", nil]
a = ['a', 'b', 'c', 'd']
a.fill(:X, 5, 2) # => ["a", "b", "c", "d", nil, :X, :X]

If length is zero or negative, replaces no elements:

a = ['a', 'b', 'c', 'd']
a.fill(:X, 1, 0) # => ["a", "b", "c", "d"]
a.fill(:X, 1, -1) # => ["a", "b", "c", "d"]

With arguments obj and Range range, and no block given, replaces elements based on the given range.

If the range is positive and ascending (0 < range.begin <= range.end), replaces elements from range.begin to range.end:

a = ['a', 'b', 'c', 'd']
a.fill(:X, (1..1)) # => ["a", :X, "c", "d"]

If range.first is negative, replaces no elements:

a = ['a', 'b', 'c', 'd']
a.fill(:X, (-1..1)) # => ["a", "b", "c", "d"]

If range.last is negative, counts from the end:

a = ['a', 'b', 'c', 'd']
a.fill(:X, (0..-2)) # => [:X, :X, :X, "d"]
a = ['a', 'b', 'c', 'd']
a.fill(:X, (1..-2)) # => ["a", :X, :X, "d"]

If range.last and range.last are both negative, both count from the end of the array:

a = ['a', 'b', 'c', 'd']
a.fill(:X, (-1..-1)) # => ["a", "b", "c", :X]
a = ['a', 'b', 'c', 'd']
a.fill(:X, (-2..-2)) # => ["a", "b", :X, "d"]

With no arguments and a block given, calls the block with each index; replaces the corresponding element with the block’s return value:

a = ['a', 'b', 'c', 'd']
a.fill { |index| "new_#{index}" } # => ["new_0", "new_1", "new_2", "new_3"]

With argument start and a block given, calls the block with each index from offset start to the end; replaces the corresponding element with the block’s return value.

If start is in range (0 <= start < array.size), replaces from offset start to the end:

a = ['a', 'b', 'c', 'd']
a.fill(1) { |index| "new_#{index}" } # => ["a", "new_1", "new_2", "new_3"]

If start is too large(start >= array.size), does nothing:

a = ['a', 'b', 'c', 'd']
a.fill(4) { |index| fail 'Cannot happen' } # => ["a", "b", "c", "d"]
a = ['a', 'b', 'c', 'd']
a.fill(4) { |index| fail 'Cannot happen' } # => ["a", "b", "c", "d"]

If start is negative, counts from the end:

a = ['a', 'b', 'c', 'd']
a.fill(-2) { |index| "new_#{index}" } # => ["a", "b", "new_2", "new_3"]

If start is too small (start <= -array.size, replaces all elements:

a = ['a', 'b', 'c', 'd']
a.fill(-6) { |index| "new_#{index}" } # => ["new_0", "new_1", "new_2", "new_3"]
a = ['a', 'b', 'c', 'd']
a.fill(-50) { |index| "new_#{index}" } # => ["new_0", "new_1", "new_2", "new_3"]

With arguments start and length, and a block given, calls the block for each index specified by start length; replaces the corresponding element with the block’s return value.

If start is in range, replaces length elements beginning at offset start:

a = ['a', 'b', 'c', 'd']
a.fill(1, 1) { |index| "new_#{index}" } # => ["a", "new_1", "c", "d"]

If start is negative, counts from the end:

a = ['a', 'b', 'c', 'd']
a.fill(-2, 1) { |index| "new_#{index}" } # => ["a", "b", "new_2", "d"]

If start is large (start >= array.size), extends self with nil:

a = ['a', 'b', 'c', 'd']
a.fill(5, 0) { |index| "new_#{index}" } # => ["a", "b", "c", "d", nil]
a = ['a', 'b', 'c', 'd']
a.fill(5, 2) { |index| "new_#{index}" } # => ["a", "b", "c", "d", nil, "new_5", "new_6"]

If length is zero or less, replaces no elements:

a = ['a', 'b', 'c', 'd']
a.fill(1, 0) { |index| "new_#{index}" } # => ["a", "b", "c", "d"]
a.fill(1, -1) { |index| "new_#{index}" } # => ["a", "b", "c", "d"]

With arguments obj and range, and a block given, calls the block with each index in the given range; replaces the corresponding element with the block’s return value.

If the range is positive and ascending (range 0 < range.begin <= range.end, replaces elements from range.begin to range.end:

a = ['a', 'b', 'c', 'd']
a.fill(1..1) { |index| "new_#{index}" } # => ["a", "new_1", "c", "d"]

If range.first is negative, does nothing:

a = ['a', 'b', 'c', 'd']
a.fill(-1..1) { |index| fail 'Cannot happen' } # => ["a", "b", "c", "d"]

If range.last is negative, counts from the end:

a = ['a', 'b', 'c', 'd']
a.fill(0..-2) { |index| "new_#{index}" } # => ["new_0", "new_1", "new_2", "d"]
a = ['a', 'b', 'c', 'd']
a.fill(1..-2) { |index| "new_#{index}" } # => ["a", "new_1", "new_2", "d"]

If range.first and range.last are both negative, both count from the end:

a = ['a', 'b', 'c', 'd']
a.fill(-1..-1) { |index| "new_#{index}" } # => ["a", "b", "c", "new_3"]
a = ['a', 'b', 'c', 'd']
a.fill(-2..-2) { |index| "new_#{index}" } # => ["a", "b", "new_2", "d"]

When invoked with a block, yield all permutations of elements of self; returns self. The order of permutations is indeterminate.

When a block and an in-range positive Integer argument n (0 < n <= self.size) are given, calls the block with all n-tuple permutations of self.

Example:

a = [0, 1, 2]
a.permutation(2) {|permutation| p permutation }

Output:

[0, 1]
[0, 2]
[1, 0]
[1, 2]
[2, 0]
[2, 1]

Another example:

a = [0, 1, 2]
a.permutation(3) {|permutation| p permutation }

Output:

[0, 1, 2]
[0, 2, 1]
[1, 0, 2]
[1, 2, 0]
[2, 0, 1]
[2, 1, 0]

When n is zero, calls the block once with a new empty Array:

a = [0, 1, 2]
a.permutation(0) {|permutation| p permutation }

Output:

[]

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

a = [0, 1, 2]
a.permutation(-1) {|permutation| fail 'Cannot happen' }
a.permutation(4) {|permutation| fail 'Cannot happen' }

When a block given but no argument, behaves the same as a.permutation(a.size):

a = [0, 1, 2]
a.permutation {|permutation| p permutation }

Output:

[0, 1, 2]
[0, 2, 1]
[1, 0, 2]
[1, 2, 0]
[2, 0, 1]
[2, 1, 0]

Returns a new Enumerator if no block given:

a = [0, 1, 2]
a.permutation # => #<Enumerator: [0, 1, 2]:permutation>
a.permutation(2) # => #<Enumerator: [0, 1, 2]:permutation(2)>
Search took: 7ms  ·  Total Results: 1359