class Staccato::Timing

Timing Hit type field definitions @author Tony Pitale

Constants

FIELDS

Timing field definitions

Public Instance Methods

track!(&block) click to toggle source

tracks the timing hit type @param block [#call] block is executed and time recorded

Calls superclass method Staccato::Hit#track!
# File lib/staccato/timing.rb, line 30
def track!(&block)
  if block_given?
    start_at = Time.now
    block.call
    end_at = Time.now

    self.options.time = (end_at - start_at).to_i*1000
  end

  super
end
type() click to toggle source

timing hit type

# File lib/staccato/timing.rb, line 24
def type
  :timing
end