Sha256: adbb4b0796b115295c941e246c8eabf5e18a6bac33fa1ceb33cacb55d6ae5a3c

Contents?: true

Size: 560 Bytes

Versions: 2

Compression:

Stored size: 560 Bytes

Contents

module RGallery
  class Pages < PhotoConfig
    include Enumerable

    def initialize photo_list = [], options = {}
      super options
      self.send(:<<, photo_list) unless photo_list.blank?
    end

    def each &block
      pages.each {|page| yield page }
    end

    def remainder
      pages[1..-1] || []
    end

    def first
      pages.first || []
    end

    def << photo_list
      pages << RGallery::Page.new(photo_list, options)
    end

    delegate :empty?, to: :pages

    protected

    def pages
      @pages ||= []
    end    
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

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