module Trailer

Constants

VERSION

Attributes

config[RW]

Public Class Methods

configure() { |config| ... } click to toggle source

Accepts a block for configuring things.

# File lib/trailer.rb, line 18
def configure
  self.config ||= Configuration.new
  yield(config) if block_given?

  # Instantiate a new recorder after configuration.
  @storage = config.storage.new if enabled?
end
enabled?() click to toggle source

Returns true if tracing is enabled, false otherwise.

# File lib/trailer.rb, line 27
def enabled?
  config&.enabled == true
end
new() click to toggle source

Returns a new recorder instance.

# File lib/trailer.rb, line 32
def new
  return unless enabled?

  raise Trailer::Error, 'Trailer.configure must be run before recording' if @storage.nil?

  Trailer::Recorder.new(@storage)
end