Sha256: 4b8319bc06e13acb04e652fa4bab854e65867c94bc82e84121d1d4768e39c59d

Contents?: true

Size: 549 Bytes

Versions: 2

Compression:

Stored size: 549 Bytes

Contents

module RestCore
  class Event < Struct.new(:duration, :message)
    def name; self.class.name[/(?<=::)\w+$/]; end
    def to_s
      if duration
        "spent #{duration} #{name} #{message}"
      else
        "#{name} #{message}"
      end
    end
  end

  Event::MultiDone    = Class.new(Event)
  Event::Requested    = Class.new(Event)
  Event::CacheHit     = Class.new(Event)
  Event::CacheCleared = Class.new(Event)
  Event::Failed       = Class.new(Event)
  Event::WithHeader   = Class.new(Event)
  Event::Retrying     = Class.new(Event)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rest-core-4.0.1 lib/rest-core/event.rb
rest-core-4.0.0 lib/rest-core/event.rb