Sha256: 746fb7fbb05a6c6f8334a2cb00c9419c0c770afaece86e10be732b68d6efb9fe

Contents?: true

Size: 413 Bytes

Versions: 92

Compression:

Stored size: 413 Bytes

Contents

module ContentImage
  DEFAULT_IMAGE = 'woople-theme/missing.png'
  MISSING_WOOPLE_IMAGE = '/images/original/missing.png'

  def image(&block)
    yield(normalized(__getobj__.image) || DEFAULT_IMAGE) if __getobj__.respond_to? :image
  end

  private

  def normalized(image)
    if image.is_a?(Paperclip::Attachment) && image.to_s == MISSING_WOOPLE_IMAGE
      DEFAULT_IMAGE
    else
      image
    end
  end
end

Version data entries

92 entries across 92 versions & 1 rubygems

Version Path
woople-theme-0.3.0 app/presenters/content_image.rb
woople-theme-0.2.49 app/presenters/content_image.rb
woople-theme-0.2.48 app/presenters/content_image.rb
woople-theme-0.2.47 app/presenters/content_image.rb
woople-theme-0.2.46 app/presenters/content_image.rb
woople-theme-0.2.45 app/presenters/content_image.rb
woople-theme-0.2.44 app/presenters/content_image.rb
woople-theme-0.2.43 app/presenters/content_image.rb
woople-theme-0.2.42 app/presenters/content_image.rb
woople-theme-0.2.41 app/presenters/content_image.rb
woople-theme-0.2.40 app/presenters/content_image.rb
woople-theme-0.2.39 app/presenters/content_image.rb
woople-theme-0.2.38 app/presenters/content_image.rb
woople-theme-0.2.37 app/presenters/content_image.rb
woople-theme-0.2.36 app/presenters/content_image.rb
woople-theme-0.2.35 app/presenters/content_image.rb
woople-theme-0.2.34 app/presenters/content_image.rb
woople-theme-0.2.33 app/presenters/content_image.rb
woople-theme-0.2.32 app/presenters/content_image.rb
woople-theme-0.2.31 app/presenters/content_image.rb