module WarpEngine::Images
The image library adapter. Software images live in a host model; the adapter tells the engine how to find, list, upload and link them. The default is HostModel; a host sets its own object with image_adapter.
Public Class Methods
Source
# File lib/warp_engine/images.rb, line 54 def adapter configured = WarpEngine.config.image_adapter case configured when nil, :host_model, "host_model" then host_model_adapter else configured end end
Returns the configured image adapter; nil, :host_model or "host_model" give the shared HostModel instance.
Source
# File lib/warp_engine/images.rb, line 87 def available?(record) = adapter.available?(record)
Delegates to the adapter’s available?.
Source
# File lib/warp_engine/images.rb, line 83 def build_from_upload(upload) = adapter.build_from_upload(upload)
Delegates to the adapter’s build_from_upload.
Source
# File lib/warp_engine/images.rb, line 64 def host_model? = adapter.is_a?(HostModel)
Returns true when the adapter is a HostModel.
Source
# File lib/warp_engine/images.rb, line 67 def host_model_adapter @host_model_adapter ||= HostModel.new end
Returns the memoized HostModel instance.
Source
# File lib/warp_engine/images.rb, line 85 def label_for(record) = adapter.label_for(record)
Delegates to the adapter’s label_for.
Source
# File lib/warp_engine/images.rb, line 79 def model = adapter.model
Delegates to the adapter’s model.
Source
# File lib/warp_engine/images.rb, line 77 def model_name = adapter.model_name
Delegates to the adapter’s model_name.
Source
# File lib/warp_engine/images.rb, line 72 def reset! @host_model_adapter = nil end
Drops the memoized HostModel instance.
Source
# File lib/warp_engine/images.rb, line 89 def select_options = adapter.select_options
Delegates to the adapter’s select_options.
Source
# File lib/warp_engine/images.rb, line 81 def url_for(image_id) = adapter.url_for(image_id)
Delegates to the adapter’s url_for.