Module: Watarase::Controller::ImageLoader

Defined in:
lib/watarase/controller.rb

Instance Method Summary collapse

Instance Method Details

#image_loadable(_image_handler, options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/watarase/controller.rb', line 10

def image_loadable(_image_handler, options = {})
  ih = _image_handler.to_s.camelize.constantize
  self.class_variable_set(:@@image_handler, ih)
  self.send(:include, Watarase::Controller::InstanceMethods)
  self.send(:caches_action, :load_image) if options[:caches]
  self.send(:before_action, :expire_caches, only: options[:expire_actions]) if options[:expire_actions]
  self.send(:before_action, :image_params, only: options[:save_actions]) if options[:save_actions]
  self.send(:helper_method, :image_thumb_path)
  self.send(:helper_method, :image_data_path)
end