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.2.30 app/presenters/content_image.rb
woople-theme-0.2.29 app/presenters/content_image.rb
woople-theme-0.2.28 app/presenters/content_image.rb
woople-theme-0.2.27 app/presenters/content_image.rb
woople-theme-0.2.26 app/presenters/content_image.rb
woople-theme-0.2.25 app/presenters/content_image.rb
woople-theme-0.2.24 app/presenters/content_image.rb
woople-theme-0.2.23 app/presenters/content_image.rb
woople-theme-0.2.22 app/presenters/content_image.rb
woople-theme-0.2.21 app/presenters/content_image.rb
woople-theme-0.2.20 app/presenters/content_image.rb
woople-theme-0.2.19 app/presenters/content_image.rb
woople-theme-0.2.18 app/presenters/content_image.rb
woople-theme-0.2.17 app/presenters/content_image.rb
woople-theme-0.2.16 app/presenters/content_image.rb
woople-theme-0.2.15 app/presenters/content_image.rb
woople-theme-0.2.14 app/presenters/content_image.rb
woople-theme-0.2.13 app/presenters/content_image.rb
woople-theme-0.2.12 app/presenters/content_image.rb
woople-theme-0.2.11 app/presenters/content_image.rb