Class: ProductionBreakpoints::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-production-breakpoints/configuration.rb

Defined Under Namespace

Modules: Modes

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

A new configuration instance



22
23
24
25
26
# File 'lib/ruby-production-breakpoints/configuration.rb', line 22

def initialize
  @mode = Modes::SIGNAL
  @signal = Modes::SIGNALS::SIGURG
  @logger = Logger.new(STDERR)
end

Instance Attribute Details

#configured_breakpointsObject (readonly)

Returns the value of attribute configured_breakpoints.



18
19
20
# File 'lib/ruby-production-breakpoints/configuration.rb', line 18

def configured_breakpoints
  @configured_breakpoints
end

#loggerObject (readonly)

Returns the value of attribute logger.



18
19
20
# File 'lib/ruby-production-breakpoints/configuration.rb', line 18

def logger
  @logger
end

#modeObject (readonly)

Returns the value of attribute mode.



18
19
20
# File 'lib/ruby-production-breakpoints/configuration.rb', line 18

def mode
  @mode
end

#pathObject

Returns the value of attribute path.



19
20
21
# File 'lib/ruby-production-breakpoints/configuration.rb', line 19

def path
  @path
end

#signalObject (readonly)

Returns the value of attribute signal.



18
19
20
# File 'lib/ruby-production-breakpoints/configuration.rb', line 18

def signal
  @signal
end

Instance Method Details

#finish!Object



28
29
30
31
32
33
34
35
# File 'lib/ruby-production-breakpoints/configuration.rb', line 28

def finish!
  if File.exist?(path)
    @configured_breakpoints = JSON.load(File.read(path))
    enable_trap
  else
    logger.error("Config file #{path} not found")
  end
end