Module: MGit::Configuration
- Extended by:
- Enumerable
- Defined in:
- lib/mgit/configuration.rb
Constant Summary collapse
- KEYS =
{ threads: { default: true, description: 'set to true if you want the fetch command to be threaded' }, plugindir: { default: File.join(AppData::AppDataVersion.latest.send(:config_dir), 'plugins'), description: 'directory from where plugin commands are loaded' }, colors: { default: true, description: 'set to false to disable all colored output' }, prune: { default: true, description: 'set to false to disable --prune for fetch command' } }
Class Method Summary collapse
Class Method Details
.each ⇒ Object
55 56 57 58 59 |
# File 'lib/mgit/configuration.rb', line 55 def self.each KEYS.each do |key| yield [key.first.to_s, send(key.first).to_s] end end |
.method_missing(meth) ⇒ Object
61 62 63 |
# File 'lib/mgit/configuration.rb', line 61 def self.method_missing(meth, *) fail ConfigurationError, "Unknown key: #{meth}" end |
.set(key, value) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/mgit/configuration.rb', line 41 def self.set(key, value) case key when 'threads', 'colors' set_boolean(key, value) when 'plugindir' unless File.directory?(value) fail ConfigurationError, 'Illegal value for key plugindir. Has to be a directory.' end self.plugindir = File.(value) else fail ConfigurationError, "Unknown key: #{key}." end end |