Sha256: 64cf94fe8a85d20346b037c742fb6ceea922b4012443895894dabdb448f4f363

Contents?: true

Size: 381 Bytes

Versions: 2

Compression:

Stored size: 381 Bytes

Contents

module ContentImage
  DEFAULT_IMAGE        = 'woople-theme/missing.png'
  MISSING_WOOPLE_IMAGE = '/assets/retina_thumb/missing.png'

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

  private

  def normalized(image)
    if image == MISSING_WOOPLE_IMAGE
      DEFAULT_IMAGE
    else
      image
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
woople-theme-0.6.11 app/presenters/content_image.rb
woople-theme-0.6.10 app/presenters/content_image.rb