module Pulsar

Defined in:

pulsar.cr
pulsar/base_event.cr

Constant Summary

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

Class Method Summary

Class Method Detail

def self.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.


[View source]
def self.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

[View source]
def self.test_mode_enabled=(test_mode_enabled : Bool) #

[View source]
def self.test_mode_enabled? : Bool #

[View source]