Method: Debian::AptPkg::Configuration.config_find

Defined in:
ext/apt_pkg/configuration.cpp

.config_find(name, default_key = '') ⇒ String

Return the value stored at the option named key, or the value given by the string default if the option in question is not set.

Params:

name

Key name.

default_key

Default key when config option not set.

Debian::AptPkg::Configuration.config_find('Dir::Etc::main') # => "apt.conf"

Returns:

  • (String)
[View source]

120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'ext/apt_pkg/configuration.cpp', line 120

static VALUE
config_find(int argc, VALUE *argv, VALUE self)
{
  if (argc > 2 || argc == 0) {
    rb_raise(rb_eArgError, "wrong number of arguments");
  }
  VALUE name, default_key;
  rb_scan_args(argc, argv, "11", &name, &default_key);
  if (NIL_P(default_key))
    default_key = rb_str_new2("");
  return rb_str_new2(_config->Find(StringValuePtr(name),
                                   StringValuePtr(default_key)).c_str());
}