Sha256: b4a3be0e54fd19389e7ef11c29e931c1b1a2a978ea4b2a2a8f51f0ac16361841

Contents?: true

Size: 641 Bytes

Versions: 2

Compression:

Stored size: 641 Bytes

Contents

module RGallery
  class Photo
    attr_reader :id, :options

    def initialize id, options = {}
      @id = id
      @options = options
    end

    def filename
      id
    end

    def file_path
      "#{filename}.#{extension}"
    end

    def path
      file_path
    end

    def thumb
      path
    end

    def title
      'no title'
    end

    def alt
      'no alt'
    end

    def description
      'no description'
    end

    def extension
      options[:extension] || self.class.extension
    end

    class << self
      attr_writer :extension

      def extension
        @extension ||= :png
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rails-gallery-0.2.1 lib/rails-gallery/rgallery/photo.rb
rails-gallery-0.2.0 lib/rails-gallery/rgallery/photo.rb