Skip to content

Commit

Permalink
Don't try to undef object_id.
Browse files Browse the repository at this point in the history
  • Loading branch information
miloops committed Sep 28, 2010
1 parent c38daa2 commit 71ac6de
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/rbench/report.rb
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
module RBench
class Report
self.instance_methods.each do |m|
send(:undef_method, m) unless m =~ /^(__|is_a?|kind_of?|respond_to?|hash|inspect|instance_eval|eql?)/
send(:undef_method, m) unless m =~ /^(__|is_a?|kind_of?|respond_to?|hash|inspect|instance_eval|object_id|eql?)/
end

attr_reader :name, :cells

def initialize(runner, group, name, times=nil,&block)
@runner = runner
@group = group
@name = name
@times = (times || runner.times).ceil
@cells = {}
@block = block
@block = block

# Setting the default for all cells
runner.columns.each {|c| @cells[c.name] = c.name == :times ? "x#{@times}" : c.default }

new_self = (class << self; self end)
@runner.columns.each do |column|
new_self.class_eval <<-CLASS
Expand All @@ -26,7 +26,7 @@ def #{column.name}(val=nil,&block)
CLASS
end
end

def run
# runs the actual benchmarks. If there is only one column, just evaluate the block itself.
if @runner.columns.length == 1
Expand All @@ -37,17 +37,17 @@ def run
# puts its row now that it is complete
puts to_s
end

def to_s
out = "%-#{@runner.desc_width}s" % name
@runner.columns.each do |column|
value = @cells[column.name]
value = @cells.values_at(*value) if value.is_a?(Array)
value = nil if value.is_a?(Array) && value.compact.length != 2

out << column.to_s(value)
end
out << @runner.newline
end
end
end
end

0 comments on commit 71ac6de

Please sign in to comment.