Class: Coercible::Configuration
- Inherits:
-
Object
- Object
- Coercible::Configuration
- Defined in:
- lib/project/configuration.rb
Overview
Configuration object for global and per coercer type settings
Class Method Summary collapse
-
.build(keys) {|config| ... } ⇒ Configuration
private
Build a configuration instance.
Class Method Details
.build(keys) {|config| ... } ⇒ Configuration
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Build a configuration instance
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/project/configuration.rb', line 14 def self.build(keys, &block) config = new keys.each do |key| config.instance_eval do define_singleton_method("#{key}") { instance_variable_get("@#{key}") } define_singleton_method("#{key}=") { |value| instance_variable_set("@#{key}", value) } end end yield(config) if block_given? config end |