In Files

Parent

Files

Bullshit::CaseMethod

This class’ instance represents a method to be benchmarked.

Attributes

comment[RW]

The comment for this method.

Public Instance Methods

after_name() click to toggle source

Return the after_name, e. g. “after_foo“.

# File lib/bullshit.rb, line 1374
    def after_name
      'after_' + short_name
    end
after_run() click to toggle source

Call after method of this CaseMethod after benchmarking it.

# File lib/bullshit.rb, line 1397
    def after_run
      if self.case.respond_to? after_name
        $DEBUG and warn "Calling #{after_name}."
        self.case.__send__(after_name)
      end
    end
before_name() click to toggle source

Return the before_name, e. g. “before_foo“.

# File lib/bullshit.rb, line 1369
    def before_name
      'before_' + short_name
    end
before_run() click to toggle source

Call before method of this CaseMethod before benchmarking it.

# File lib/bullshit.rb, line 1389
    def before_run
      if self.case.respond_to? before_name
        $DEBUG and warn "Calling #{before_name}."
        self.case.__send__(before_name)
      end
    end
cover?(other) click to toggle source

Return true if this CaseMethod#clock covers other.clock.

# File lib/bullshit.rb, line 1384
    def cover?(other)
      clock.cover?(other.clock)
    end
file_path(type = nil, suffix = '.dat') click to toggle source

Return the file name for type with suffix (if any) for this clock.

# File lib/bullshit.rb, line 1405
    def file_path(type = nil, suffix = '.dat')
      name = self.case.class.benchmark_name.dup
      name << '#' << short_name
      type and name << '-' << type
      name << suffix
      File.expand_path(name, self.case.class.output_dir)
    end
load(fp = file_path) click to toggle source

Load the data of file fp into this clock.

# File lib/bullshit.rb, line 1414
    def load(fp = file_path)
      self.clock = self.case.class.clock.new self
      $DEBUG and warn "Loading '#{fp}' into clock."
      File.open(fp, 'r') do |f|
        f.each do |line|
          line.chomp!
          line =~ /^\s*#/ and next
          clock << line.split(/\t/)
        end
      end
      self
    rescue Errno::ENOENT
    end
long_name() click to toggle source

Returns the long_name of this CaseMethod of the form Foo#bar.

# File lib/bullshit.rb, line 1357
    def long_name
      result = "#{self.case}##{short_name}"
      result = "#{result} (#{comment})" if comment
      result
    end
Also aliased as: to_s
setup_name() click to toggle source

Return the setup_name, e. g. “setup_foo“.

# File lib/bullshit.rb, line 1364
    def setup_name
      'setup_' + short_name
    end
short_name() click to toggle source

Return the short name of this CaseMethod instance, that is without the “benchmark_” prefix, e. g. “foo”.

# File lib/bullshit.rb, line 1349
    def short_name
      @short_name ||= name.sub(/\Abenchmark_/, '')
    end
teardown_name() click to toggle source

Return the teardown_name, e. g. “teardown_foo“.

# File lib/bullshit.rb, line 1379
    def teardown_name
      'teardown_' + short_name
    end
to_s() click to toggle source

Alias for long_name

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.