Module: Dragonfly::Configurable::InstanceMethods
- Defined in:
- lib/dragonfly/configurable.rb
Instance Method Summary (collapse)
- - (Object) config_methods
- - (Object) configuration
- - (Object) configure {|ConfigurationProxy.new(self)| ... }
- - (Object) configure_with(config, *args, &block)
- - (Object) default_configuration
- - (Boolean) has_config_method?(method_name)
- - (Object) set_config_value(key, value)
- - (Object) use_as_fallback_config(other_configurable)
Instance Method Details
- (Object) config_methods
47 48 49 |
# File 'lib/dragonfly/configurable.rb', line 47 def config_methods @config_methods ||= self.class.config_methods.dup end |
- (Object) configuration
43 44 45 |
# File 'lib/dragonfly/configurable.rb', line 43 def configuration @configuration ||= {} end |
- (Object) configure {|ConfigurationProxy.new(self)| ... }
27 28 29 30 |
# File 'lib/dragonfly/configurable.rb', line 27 def configure(&block) yield ConfigurationProxy.new(self) self end |
- (Object) configure_with(config, *args, &block)
32 33 34 35 36 37 |
# File 'lib/dragonfly/configurable.rb', line 32 def configure_with(config, *args, &block) config = saved_config_for(config) if config.is_a?(Symbol) config.apply_configuration(self, *args) configure(&block) if block self end |
- (Object) default_configuration
51 52 53 |
# File 'lib/dragonfly/configurable.rb', line 51 def default_configuration @default_configuration ||= self.class.default_configuration.dup end |
- (Boolean) has_config_method?(method_name)
39 40 41 |
# File 'lib/dragonfly/configurable.rb', line 39 def has_config_method?(method_name) config_methods.include?(method_name.to_sym) end |
- (Object) set_config_value(key, value)
55 56 57 58 59 |
# File 'lib/dragonfly/configurable.rb', line 55 def set_config_value(key, value) configuration[key] = value child_configurables.each{|c| c.set_if_unset(key, value) } value end |
- (Object) use_as_fallback_config(other_configurable)
61 62 63 64 |
# File 'lib/dragonfly/configurable.rb', line 61 def use_as_fallback_config(other_configurable) other_configurable.add_child_configurable(self) self.fallback_configurable = other_configurable end |