Method: Rugged::Config#to_hash

Defined in:
ext/rugged/rugged_config.c

#to_hashHash

Returns the config file represented as a Ruby hash, where each configuration entry appears as a key with its corresponding value.

cfg.to_hash #=> {"core.autolf" => "true", "core.bare" => "true"}

Returns:

  • (Hash)

273
274
275
276
277
278
279
280
281
282
283
284
285
# File 'ext/rugged/rugged_config.c', line 273

static VALUE rb_git_config_to_hash(VALUE self)
{
	git_config *config;
	int error;
	VALUE hash;

	Data_Get_Struct(self, git_config, config);
	hash = rb_hash_new();

	error = git_config_foreach(config, &cb_config__to_hash, (void *)hash);
	rugged_exception_check(error);
	return hash;
}