Sha256: 908aa7347dbcaa21f1014e212a928a81744b900e3fad8e0bfb67b24dd39d544e
Contents?: true
Size: 1.79 KB
Versions: 7
Compression:
Stored size: 1.79 KB
Contents
module Workarea module Catalog class ProductPlaceholderImage include ApplicationDocument extend Dragonfly::Model field :image_uid, type: String # # The values for the following fields are automatically populated via # Dragonfly built-in analysers. The values can be accessed by the "magic # attributes" that are dynamically added to the model. # # More info: # - http://markevans.github.io/dragonfly/imagemagick/#analysers # - http://markevans.github.io/dragonfly/models/#magic-attributes # field :image_width, type: Integer # image.width # => 900 field :image_height, type: Integer # image.height # => 450 field :image_aspect_ratio, type: Float # image.aspect_ratio # => 2.0 field :image_portrait, type: Boolean # image.portrait? # => true field :image_landscape, type: Boolean # image.landscape? # => false field :image_format, type: String # image.format # => 'png' field :image_image, type: Boolean # image.image? # => true dragonfly_accessor :image, app: :workarea class << self def cached @image ||= first || create_from_pipeline! end private def create_from_pipeline! create!( image: FindPipelineAsset.new( Workarea.config.product_placeholder_image_name ).path ) end end def placeholder? true end def respond_to_missing?(method_name, include_private = false) super || image.respond_to?(method_name) end def method_missing(sym, *args, &block) image.send(sym, *args, &block) if image.respond_to?(sym) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems