Class: PrettyTrace::Handler

Inherits:
Object
  • Object
show all
Includes:
Colors, Singleton
Defined in:
lib/pretty_trace/handler.rb

Instance Method Summary collapse

Methods included from Colors

#colors

Instance Method Details

#disableObject



21
22
23
# File 'lib/pretty_trace/handler.rb', line 21

def disable
  @enabled = false
end

#enableObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/pretty_trace/handler.rb', line 8

def enable
  @enabled = true
  # :nocov: - this is actually covered through an external process
  at_exit do
    if @enabled and $! and !ignored.include? $!.class
      show_errors $!
      $stderr.reopen IO::NULL
      $stdout.reopen IO::NULL
    end
  end
  # :nocov:
end

#enabled?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/pretty_trace/handler.rb', line 25

def enabled?
  @enabled
end

#optionsObject



29
30
31
# File 'lib/pretty_trace/handler.rb', line 29

def options
  @options ||= default_options
end

#options=(new_options) ⇒ Object



33
34
35
# File 'lib/pretty_trace/handler.rb', line 33

def options=(new_options)
  @options = new_options
end