class RGallery::Pages
Public Class Methods
new(photo_list = [], options = {})
click to toggle source
Calls superclass method
# File lib/rails-gallery/rgallery/pages.rb, line 5 def initialize photo_list = [], options = {} super options self.send(:<<, photo_list) unless photo_list.blank? end
Public Instance Methods
<<(photo_list)
click to toggle source
# File lib/rails-gallery/rgallery/pages.rb, line 22 def << photo_list pages << RGallery::Page.new(photo_list, options) end
add_photo_sources(sources_hash)
click to toggle source
a Hash where each element is a source of the form: ‘banner’ => [{src: ‘banner-HD’, sizing: ‘2x’}, {src: ‘banner-phone’, sizing: ‘100w’}]
# File lib/rails-gallery/rgallery/pages.rb, line 34 def add_photo_sources sources_hash sources_hash.each do |source| pages.add_photo_w_sources source end end
add_photo_w_sources(source)
click to toggle source
a source is a hash of the form: ‘banner’ => [{src: ‘banner-HD’, sizing: ‘2x’}, {src: ‘banner-phone’, sizing: ‘100w’}]
# File lib/rails-gallery/rgallery/pages.rb, line 28 def add_photo_w_sources source pages << RGallery::Page.from_source(source, options) end
each() { |page| ... }
click to toggle source
# File lib/rails-gallery/rgallery/pages.rb, line 10 def each &block pages.each {|page| yield page } end
first()
click to toggle source
# File lib/rails-gallery/rgallery/pages.rb, line 18 def first pages.first || [] end
remainder()
click to toggle source
# File lib/rails-gallery/rgallery/pages.rb, line 14 def remainder pages[1..-1] || [] end
Protected Instance Methods
pages()
click to toggle source
# File lib/rails-gallery/rgallery/pages.rb, line 45 def pages @pages ||= [] end