Sha256: 0b8e0af8e52b02fcc9a48e15dbadf8b0a602146ef7ccf7677f14d8b7f2120cc2

Contents?: true

Size: 441 Bytes

Versions: 2

Compression:

Stored size: 441 Bytes

Contents

module RGallery
  class Page < PhotoConfig
    include Enumerable

    def initialize photo_ids = [], options = {}
      @photo_ids = photo_ids
      super options
    end

    def photo_ids
      @photo_ids ||= []
    end   

    def photos
      @photos ||= photo_ids.map {|id| photo_class.new id, options } 
    end   

    delegate :empty?, to: :photos 

    def each &block
      photos.each {|photo| yield photo }
    end    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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