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