Sha256: 86b86b73d6e21b5dfa7ae7b98683fff8a5b68f7096f92250e0175c199c572ca0

Contents?: true

Size: 586 Bytes

Versions: 3

Compression:

Stored size: 586 Bytes

Contents

module Timeasure
  class Measurement
    attr_reader :klass_name, :method_name, :segment, :metadata, :t0, :t1

    def initialize(klass_name:, method_name:, t0:, t1:, segment: nil, metadata: nil)
      @klass_name = klass_name
      @method_name = method_name
      @t0 = t0
      @t1 = t1
      @segment = segment
      @metadata = metadata
    end

    def runtime_in_milliseconds
      (@t1 - @t0) * 1000
    end

    def full_path
      @segment.nil? ? method_path : "#{method_path}:#{@segment}"
    end

    def method_path
      "#{@klass_name}##{@method_name}"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
timeasure-0.2.0 lib/timeasure/measurement.rb
timeasure-0.1.1 lib/timeasure/measurement.rb
timeasure-0.1.0 lib/timeasure/measurement.rb