Class: Workarea::Catalog::ProductImage

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

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



60
61
62
# File 'app/models/workarea/catalog/product_image.rb', line 60

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

Instance Method Details

#image_inverse_aspect_ratioObject



51
52
53
54
# File 'app/models/workarea/catalog/product_image.rb', line 51

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)


47
48
49
# File 'app/models/workarea/catalog/product_image.rb', line 47

def placeholder?
  false
end

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

Returns:

  • (Boolean)


56
57
58
# File 'app/models/workarea/catalog/product_image.rb', line 56

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

#valid?Boolean

Returns:

  • (Boolean)


42
43
44
45
# File 'app/models/workarea/catalog/product_image.rb', line 42

def valid?(*)
  self.position ||= _parent.images.length - 1
  super
end