In Files

  • debug-1.4.0/lib/debug/config.rb

DEBUGGER__::Config

Public Class Methods

config() click to toggle source
 
               # File debug-1.4.0/lib/debug/config.rb, line 56
def self.config
  @config
end
            
new(argv) click to toggle source
 
               # File debug-1.4.0/lib/debug/config.rb, line 60
def initialize argv
  if self.class.config
    raise 'Can not make multiple configurations in one process'
  end

  update self.class.parse_argv(argv)
end
            

Public Instance Methods

[](key) click to toggle source
 
               # File debug-1.4.0/lib/debug/config.rb, line 72
def [](key)
  config[key]
end
            
[]=(key, val) click to toggle source
 
               # File debug-1.4.0/lib/debug/config.rb, line 76
def []=(key, val)
  set_config(key => val)
end
            
append_config(key, val) click to toggle source
 
               # File debug-1.4.0/lib/debug/config.rb, line 93
def append_config key, val
  conf = config.dup

  if CONFIG_SET[key]
    if CONFIG_SET[key][2] == :path
      conf[key] = [*conf[key], *parse_config_value(key, val)];
    else
      raise "not an Array type: #{key}"
    end
  else
    raise "Unknown configuration: #{key}"
  end

  update conf
end
            
inspect() click to toggle source
 
               # File debug-1.4.0/lib/debug/config.rb, line 68
def inspect
  config.inspect
end
            
set_config(**kw) click to toggle source
 
               # File debug-1.4.0/lib/debug/config.rb, line 80
def set_config(**kw)
  conf = config.dup
  kw.each{|k, v|
    if CONFIG_MAP[k]
      conf[k] = parse_config_value(k, v) # TODO: ractor support
    else
      raise "Unknown configuration: #{k}"
    end
  }

  update conf
end
            
update(conf) click to toggle source
 
               # File debug-1.4.0/lib/debug/config.rb, line 109
def update conf
  old_conf = self.class.instance_variable_get(:@config) || {}

  # TODO: Use Ractor.make_shareable(conf)
  self.class.instance_variable_set(:@config, conf.freeze)

  # Post process
  if_updated old_conf, conf, :keep_alloc_site do |_, new|
    if new
      require 'objspace'
      ObjectSpace.trace_object_allocations_start
    else
      ObjectSpace.trace_object_allocations_stop
    end
  end

  if_updated old_conf, conf, :postmortem do |_, new_p|
    if defined?(SESSION)
      SESSION.postmortem = new_p
    end
  end

  if_updated old_conf, conf, :sigdump_sig do |old_sig, new_sig|
    setup_sigdump old_sig, new_sig
  end
end
            
There is an updated format of the API docs for this version here.