class Tracebin::Recorder

Constants

LOCK
THREAD_LOCAL_KEY

Public Class Methods

<<(event)
Alias for: add_event
add_event(event) click to toggle source
# File lib/tracebin/recorder.rb, line 25
def add_event(event)
  return unless self.recording?
  self.current[:events] ||= []
  self.current[:events] << event.data_hash
end
Also aliased as: <<
current() click to toggle source
# File lib/tracebin/recorder.rb, line 7
def current
  LOCK.synchronize do
    Thread.current[THREAD_LOCAL_KEY]
  end
end
current=(val) click to toggle source
# File lib/tracebin/recorder.rb, line 13
def current=(val)
  Thread.current[THREAD_LOCAL_KEY] = val
end
events() click to toggle source
# File lib/tracebin/recorder.rb, line 32
def events
  self.current[:events]
end
recording?() click to toggle source
# File lib/tracebin/recorder.rb, line 21
def recording?
  !self.current.nil?
end
start_recording() click to toggle source
# File lib/tracebin/recorder.rb, line 17
def start_recording
  self.current = {}
end
stop_recording() click to toggle source
# File lib/tracebin/recorder.rb, line 36
def stop_recording
  LOCK.synchronize do
    Thread.current[THREAD_LOCAL_KEY] = nil
  end
end