class Rubydex::Config
Attributes
Returns the linter settings read from the [linter] section. Its rules are empty when the section is absent.
Public Class Methods
static VALUE rdxr_config_load(VALUE klass, VALUE workspace_path) {
Check_Type(workspace_path, T_STRING);
struct CConfigResult result = rdx_config_load(StringValueCStr(workspace_path));
if (result.error != NULL) {
VALUE message = rb_utf8_str_new_cstr(result.error);
free_c_string(result.error);
VALUE config_error = rb_const_get(mRubydex, rb_intern("ConfigError"));
rb_exc_raise(rb_exc_new_str(config_error, message));
}
VALUE config = TypedData_Wrap_Struct(klass, &config_type, result.config);
rb_ivar_set(config, id_linter, config_linter(config));
return config;
}
Loads the configuration of the workspace rooted at workspace_path, which is where its rubydex.toml is expected to be. A workspace without a configuration file gets an empty configuration. Raises Rubydex::ConfigError if the file exists, but cannot be read or is malformed.
Public Instance Methods
Source
static VALUE rdxr_config_workspace_path(VALUE self) {
const char *result = rdx_config_workspace_path(rdxi_config_from_object(self));
// A configuration always has a workspace, so there is no absent case to hand back to Ruby. NULL only means the
// conversion itself failed, which is why this raises instead of returning nil.
if (result == NULL) {
rb_raise(rb_eRuntimeError, "Converting workspace path to Ruby string failed");
}
return rdxi_owned_c_string_to_ruby(result);
}
Returns the root directory of the workspace this configuration was loaded for.