Sha256: b3282aa147c37898051983c678293fa914c53da8566065be4ecba396575ff71e
Contents?: true
Size: 770 Bytes
Versions: 19
Compression:
Stored size: 770 Bytes
Contents
module Flipper module Instrumenters # Instrumentor that is useful for tests as it stores each of the events that # are instrumented. class Memory Event = Struct.new(:name, :payload, :result) attr_reader :events def initialize @events = [] end def instrument(name, payload = {}) # Copy the payload to guard against later modifications to it, and to # ensure that all instrumentation code uses the payload passed to the # block rather than the one passed to #instrument. payload = payload.dup result = if block_given? yield payload else nil end @events << Event.new(name, payload, result) result end end end end
Version data entries
19 entries across 19 versions & 1 rubygems