Class: Dragonfly::Configurable::ConfigurationProxy
- Defined in:
- lib/dragonfly/configurable.rb
Instance Method Summary collapse
-
#initialize(owner) ⇒ ConfigurationProxy
constructor
A new instance of ConfigurationProxy.
- #method_missing(method_name, *args, &block) ⇒ Object
Constructor Details
#initialize(owner) ⇒ ConfigurationProxy
Returns a new instance of ConfigurationProxy.
94 95 96 |
# File 'lib/dragonfly/configurable.rb', line 94 def initialize(owner) @owner = owner end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
98 99 100 101 102 103 104 105 106 |
# File 'lib/dragonfly/configurable.rb', line 98 def method_missing(method_name, *args, &block) if owner.has_configuration_method?(method_name) owner.send(method_name, *args, &block) elsif nested_configurable?(method_name, *args) owner.send(method_name, *args) else raise BadConfigAttribute, "You tried to configure using '#{method_name.inspect}', but the valid config attributes are #{owner.configuration_methods.map{|a| %('#{a.inspect}') }.sort.join(', ')}" end end |