Results for: "gsub"

Returns whether the method is public.

With no block given, returns the sum of initial_value and the elements:

(1..100).sum          # => 5050
(1..100).sum(1)       # => 5051
('a'..'d').sum('foo') # => "fooabcd"

Generally, the sum is computed using methods + and each; for performance optimizations, those methods may not be used, and so any redefinition of those methods may not have effect here.

One such optimization: When possible, computes using Gauss’s summation formula n(n+1)/2:

100 * (100 + 1) / 2 # => 5050

With a block given, calls the block with each element; returns the sum of initial_value and the block return values:

(1..4).sum {|i| i*i }                        # => 30
(1..4).sum(100) {|i| i*i }                   # => 130
h = {a: 0, b: 1, c: 2, d: 3, e: 4, f: 5}
h.sum {|key, value| value.odd? ? value : 0 } # => 9
('a'..'f').sum('x') {|c| c < 'd' ? c : '' }  # => "xabc"

Start/resume the coverage measurement.

Caveat: Currently, only process-global coverage measurement is supported. You cannot measure per-thread covearge. If your process has multiple thread, using Coverage.resume/suspend to capture code coverage executed from only a limited code block, may yield misleading results.

Suspend the coverage measurement. You can use Coverage.resume to restart the measurement.

Returns a hash that contains filename as key and coverage array as value. If clear is true, it clears the counters to zero. If stop is true, it disables coverage measurement.

Returns a BubbleBabble encoded version of a given string.

Returns whether input encoding is UTF-8 or not.

Returns whether input encoding is UTF-8 or not.

Returns the time used to execute the given block as a Benchmark::Tms object. Takes label option.

require 'benchmark'

n = 1000000

time = Benchmark.measure do
  n.times { a = "1" }
end
puts time

Generates:

0.220000   0.000000   0.220000 (  0.227313)

Returns the time used to execute the given block as a Benchmark::Tms object. Takes label option.

require 'benchmark'

n = 1000000

time = Benchmark.measure do
  n.times { a = "1" }
end
puts time

Generates:

0.220000   0.000000   0.220000 (  0.227313)

The path to the running Ruby interpreter.

Suffixes for require-able paths.

No documentation available
No documentation available

Returns the BubbleBabble encoded hash value of a given string.

Returns the flags of ifaddr.

Produces the summary text. Each line of the summary is yielded to the block (without newline).

sdone

Already summarized short style options keyed hash.

ldone

Already summarized long style options keyed hash.

width

Width of left side (option part). In other words, the right side (description part) starts after width columns.

max

Maximum width of left side -> the options are filled within max columns.

indent

Prefix string indents all summarized lines.

Creates the summary table, passing each line to the block (without newline). The arguments args are passed along to the summarize method which is called on every option.

Whether this specification is stubbed - i.e. we have information about the gem from a stub line, without having to evaluate the entire gemspec file.

Returns a Gem::StubSpecification for every installed gem

A short summary of this gem’s description.

No documentation available
No documentation available

Returns true if stat is successful, false if not. Returns nil if exited? is not true.

Returns the resulting hash value in a Bubblebabble encoded form.

Search took: 3ms  ·  Total Results: 274