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.6.9 app/presenters/content_image.rb
woople-theme-0.6.8 app/presenters/content_image.rb
woople-theme-0.6.7 app/presenters/content_image.rb
woople-theme-0.6.6 app/presenters/content_image.rb
woople-theme-0.6.5 app/presenters/content_image.rb
woople-theme-0.6.4 app/presenters/content_image.rb
woople-theme-0.6.3 app/presenters/content_image.rb
woople-theme-0.6.2 app/presenters/content_image.rb
woople-theme-0.6.1 app/presenters/content_image.rb
woople-theme-0.6 app/presenters/content_image.rb
woople-theme-0.5.17 app/presenters/content_image.rb
woople-theme-0.5.16 app/presenters/content_image.rb
woople-theme-0.5.15 app/presenters/content_image.rb
woople-theme-0.5.14 app/presenters/content_image.rb
woople-theme-0.5.13 app/presenters/content_image.rb
woople-theme-0.5.12 app/presenters/content_image.rb
woople-theme-0.5.11 app/presenters/content_image.rb
woople-theme-0.5.10 app/presenters/content_image.rb
woople-theme-0.5.9 app/presenters/content_image.rb
woople-theme-0.5.8 app/presenters/content_image.rb