Class: Cinch::Configuration::Plugins
- Inherits:
-
Cinch::Configuration
- Object
- OpenStruct
- Cinch::Configuration
- Cinch::Configuration::Plugins
- Defined in:
- lib/cinch/configuration/plugins.rb
Overview
Constant Summary collapse
- KNOWN_OPTIONS =
[:plugins, :prefix, :suffix, :options]
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Cinch::Configuration
#[], #[]=, #initialize, #load!, #to_h
Constructor Details
This class inherits a constructor from Cinch::Configuration
Class Method Details
.default_config ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/cinch/configuration/plugins.rb', line 11 def self.default_config { plugins: [], prefix: /^!/, suffix: nil, options: Hash.new { |h, k| h[k] = {} } } end |
Instance Method Details
#load(new_config, from_default = false) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/cinch/configuration/plugins.rb', line 20 def load(new_config, from_default = false) fresh_new_config = {} new_config.each do |option, value| case option when :plugins fresh_new_config[option] = value.map { |v| Cinch::Utilities::Kernel.string_to_const(v) } when :options fresh_value = self[:options] value.each do |k, v| k = Cinch::Utilities::Kernel.string_to_const(k) v = self[:options][k].merge(v) fresh_value[k] = v end fresh_new_config[option] = fresh_value else fresh_new_config[option] = value end end super(fresh_new_config, from_default) end |