class ProductionBreakpoints::Configuration

Attributes

configured_breakpoints[R]
logger[R]
mode[R]
path[RW]
signal[R]

Public Class Methods

new() click to toggle source

A new configuration instance

# File lib/ruby-production-breakpoints/configuration.rb, line 22
def initialize
  @mode = Modes::SIGNAL
  @signal = Modes::SIGNALS::SIGURG
  @logger = Logger.new(STDERR)
end

Public Instance Methods

finish!() click to toggle source
# File lib/ruby-production-breakpoints/configuration.rb, line 28
def finish!
  enable_trap
  reload!
end
reload!() click to toggle source
# File lib/ruby-production-breakpoints/configuration.rb, line 33
def reload!
  if File.exist?(path)
    @configured_breakpoints = JSON.load(File.read(path))
  else
    logger.error("Config file #{path} not found")
  end
end

Private Instance Methods

disable_trap() click to toggle source

Disables trap handler

# File lib/ruby-production-breakpoints/configuration.rb, line 44
def disable_trap
  Signal.trap(@signal, 'DEFAULT')
end
enable_trap() click to toggle source

Enables a new trap handler

# File lib/ruby-production-breakpoints/configuration.rb, line 49
def enable_trap
  # ProductionBreakpoints.config.logger.debug("trap handler enabled for #{@signal}")
  Signal.trap(@signal) { ProductionBreakpoints.sync! }
end