Skip to content

Commit

Permalink
Work on Benchmark::Tms documentation [ci skip]
Browse files Browse the repository at this point in the history
[ruby-core:88874] [Bug #15080]

From: Richard Wardin <[email protected]>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Sep 15, 2018
1 parent 0d7face commit 97f8d0f
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions lib/benchmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,9 @@ def add(&blk) # :yield:

#
# An in-place version of #add.
# Changes the times of this Tms object by making it the sum of the times
# for this Tms object, plus the time required to execute
# the code block (+blk+).
#
def add!(&blk)
t = Benchmark.measure(&blk)
Expand All @@ -452,28 +455,28 @@ def add!(&blk)

#
# Returns a new Tms object obtained by memberwise summation
# of the individual times for this Tms object with those of the other
# of the individual times for this Tms object with those of the +other+
# Tms object.
# This method and #/() are useful for taking statistics.
#
def +(other); memberwise(:+, other) end

#
# Returns a new Tms object obtained by memberwise subtraction
# of the individual times for the other Tms object from those of this
# of the individual times for the +other+ Tms object from those of this
# Tms object.
#
def -(other); memberwise(:-, other) end

#
# Returns a new Tms object obtained by memberwise multiplication
# of the individual times for this Tms object by _x_.
# of the individual times for this Tms object by +x+.
#
def *(x); memberwise(:*, x) end

#
# Returns a new Tms object obtained by memberwise division
# of the individual times for this Tms object by _x_.
# of the individual times for this Tms object by +x+.
# This method and #+() are useful for taking statistics.
#
def /(x); memberwise(:/, x) end
Expand Down Expand Up @@ -529,7 +532,7 @@ def to_a
#
# Returns a new Tms object obtained by memberwise operation +op+
# of the individual times for this Tms object with those of the other
# Tms object.
# Tms object (+x+).
#
# +op+ can be a mathematical operation such as <tt>+</tt>, <tt>-</tt>,
# <tt>*</tt>, <tt>/</tt>
Expand Down

0 comments on commit 97f8d0f

Please sign in to comment.