Class: Jiminy::Configuration
- Inherits:
-
Object
- Object
- Jiminy::Configuration
show all
- Defined in:
- lib/jiminy/configuration.rb
Defined Under Namespace
Classes: MissingConfigError
Constant Summary
collapse
- DEFAULT_CONFIG_READER =
-> { instance_variable_get(:"@_#{__callee__}" || raise_missing_required(__callee__)) }
- DEFAULT_CONFIG_WRITER =
->(value) { instance_variable_set(:"@_#{__callee__}"[0..-2], value) }
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of Configuration.
57
58
59
|
# File 'lib/jiminy/configuration.rb', line 57
def initialize
apply_defaults!
end
|
Class Method Details
.define_config(name, options = {}) ⇒ Object
28
29
30
31
32
|
# File 'lib/jiminy/configuration.rb', line 28
def define_config(name, options = {})
define_method(:"#{name}=", DEFAULT_CONFIG_WRITER)
define_method(name.to_sym, DEFAULT_CONFIG_READER)
defined_configs[name].merge!(options)
end
|
.defined_configs ⇒ Object
34
35
36
|
# File 'lib/jiminy/configuration.rb', line 34
def defined_configs
@_defined_configs ||= Hash.new { |hash, key| hash[key] = { default: nil, required: true } }
end
|
Instance Method Details
#repo_path ⇒ Object
61
62
63
|
# File 'lib/jiminy/configuration.rb', line 61
def repo_path
[project_username, project_reponame].join("/")
end
|