module

Pulsar

Constants

EVENT_TYPES = [] of Pulsar::Event.class | Pulsar::TimedEvent.class
VERSION = "0.2.3"

Class methods

elapsed_text(elapsed : Time::Span) : String

Will return the time taken (Time::Span) as a human readable String.

Database::QueryEvent.subscribe do |event, duration|
  puts Pulsar.elaspted_text(duration) # "2.3ms"
end

This method can be used with any Time::Span.

Source
enable_test_mode!

Enable test mode to log published events

This will enable an in memory log of events that gets cleared before each spec is run. You can access an Event's log using the logged_events class method

MyEvent.publish

MyEvent.logged_events.size.should eq(1)
MyEvent.logged_events.first # Returns the event that was published
Source
test_mode_enabled=(test_mode_enabled : Bool)
Source
test_mode_enabled?
Source

Nested types