class ImageResizer::Configurable::ConfigurationProxy
Attributes
owner[R]
Public Class Methods
new(owner)
click to toggle source
# File lib/image_resizer/configurable.rb, line 176 def initialize(owner) @owner = owner end
Public Instance Methods
method_missing(method_name, *args, &block)
click to toggle source
# File lib/image_resizer/configurable.rb, line 180 def method_missing(method_name, *args, &block) if owner.has_config_method?(method_name) attribute = method_name.to_s.tr('=','').to_sym if method_name.to_s =~ /=$/ && owner.has_config_method?(attribute) # a bit hacky - if it has both getter and setter, assume it's a configurable_attr owner.set_config_value(attribute, args.first) else owner.send(method_name, *args, &block) end elsif nested_configurable?(method_name) owner.send(method_name) else raise BadConfigAttribute, "You tried to configure using '#{method_name.inspect}', but the valid config attributes are #{owner.config_methods.map{|a| %('#{a.inspect}') }.sort.join(', ')}" end end
Private Instance Methods
nested_configurable?(method)
click to toggle source
# File lib/image_resizer/configurable.rb, line 199 def nested_configurable?(method) owner.class.nested_configurables.include?(method.to_sym) end