Class: Workarea::Catalog::ProductPlaceholderImage

Inherits:
Object
  • Object
show all
Extended by:
Dragonfly::Model
Includes:
ApplicationDocument
Defined in:
app/models/workarea/catalog/product_placeholder_image.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ApplicationDocument

#releasable?

Methods included from Sidekiq::Callbacks

assert_valid_config!, async, disable, enable, inline, #run_callbacks

Methods included from Mongoid::Document

#embedded_children

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(sym, *args, &block) ⇒ Object



57
58
59
# File 'app/models/workarea/catalog/product_placeholder_image.rb', line 57

def method_missing(sym, *args, &block)
  image.send(sym, *args, &block) if image.respond_to?(sym)
end

Class Method Details

.cachedObject



29
30
31
# File 'app/models/workarea/catalog/product_placeholder_image.rb', line 29

def cached
  @image ||= first || create_from_pipeline!
end

Instance Method Details

#image_inverse_aspect_ratioObject



48
49
50
51
# File 'app/models/workarea/catalog/product_placeholder_image.rb', line 48

def image_inverse_aspect_ratio
  return if image_aspect_ratio.blank? || image_aspect_ratio.zero?
  1 / image_aspect_ratio.to_f
end

#placeholder?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'app/models/workarea/catalog/product_placeholder_image.rb', line 44

def placeholder?
  true
end

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


53
54
55
# File 'app/models/workarea/catalog/product_placeholder_image.rb', line 53

def respond_to_missing?(method_name, include_private = false)
  super || image.respond_to?(method_name)
end