Sha256: 7d53799f5b721e5bed1b5800ca974aab06a836a2ce91db0ac38837b5788b7cfd

Contents?: true

Size: 721 Bytes

Versions: 1

Compression:

Stored size: 721 Bytes

Contents

module Imagery
  module Missing
    # Allows you to set the current filename of your photo.
    # Much of Imagery::Missing is hinged on this.
    #
    # @example
    #
    #   Photo = Class.new(Struct.new(:id))
    #   i = Imagery::Model.new(Photo.new(1001))
    #   i.extend Imagery::Missing
    #   i.url == "/photo/1001/original.png"
    #   # => true
    #
    #   i.existing = "Filename"
    #   i.url == "/missing/photo/original.png"
    #   # => true
    #
    # @see Imagery::Missing#url
    #
    attr_accessor :existing

    def url(size = self.default_size)
      if existing.to_s.empty?
        return ['', 'missing', namespace, filename(size)].join('/')
      else
        super
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
imagery-0.0.6 lib/imagery/missing.rb