Module: Coercible::Coercer::Configurable
Class Method Summary collapse
-
.extended(coercer) ⇒ self
private
Add configuration-specific option keys to the descendant.
Instance Method Summary collapse
-
#config {|| ... } ⇒ Configuration
Build configuration object for the coercer class.
-
#config_name ⇒ Symbol
private
Return configuration name in the global config.
-
#configuration_class ⇒ Class:Configuration
private
Return configuration class.
Class Method Details
.extended(coercer) ⇒ self
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.
Add configuration-specific option keys to the descendant
11 12 13 14 |
# File 'lib/coercible/coercer/configurable.rb', line 11 def self.extended(coercer) coercer. :config_keys super end |
Instance Method Details
#config {|| ... } ⇒ Configuration
Build configuration object for the coercer class
36 37 38 39 40 |
# File 'lib/coercible/coercer/configurable.rb', line 36 def config(&block) configuration = configuration_class.build(config_keys) yield configuration configuration end |
#config_name ⇒ Symbol
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.
Return configuration name in the global config
47 48 49 |
# File 'lib/coercible/coercer/configurable.rb', line 47 def config_name name.downcase.split('::').last.to_sym end |
#configuration_class ⇒ Class: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.
Return configuration class
56 57 58 |
# File 'lib/coercible/coercer/configurable.rb', line 56 def configuration_class Configuration end |