lib/rails-gallery/rgallery/page.rb in rails-gallery-0.3.0 vs lib/rails-gallery/rgallery/page.rb in rails-gallery-0.3.1
- old
+ new
@@ -1,11 +1,11 @@
module RGallery
class Page < PhotoConfig
include Enumerable
- def initialize photo_ids = [], options = {}
- @photo_ids = photo_ids
+ def initialize photo_objs = [], options = {}
+ @photo_objs = photo_objs
super options
end
# a source is a hash of the form:
# 'banner' => [{src: 'banner-HD', sizing: '2x'}, {src: 'banner-phone', sizing: '100w'}]
@@ -16,13 +16,13 @@
@photos ||= sources.map do |key, srclist|
photo_class.new key, options.merge(:sources => srclist)
end
end
- def << photo_ids
- @photo_ids ||= []
- @photo_ids += [photo_ids].flatten
+ def << photo_objs
+ @photo_objs ||= []
+ @photo_objs += [photo_objs].flatten
end
def add_photo_sources sources_hash
sources_hash.each do |source|
add_photo_w_sources source
@@ -38,15 +38,15 @@
self.send :<<, key
@photos ||= []
@photos << photo_class.new(key, options.merge(:sources => srclist))
end
- def photo_ids
- @photo_ids ||= []
+ def photo_objs
+ @photo_objs ||= []
end
def photos
- @photos ||= photo_ids.map {|id| photo_class.new id, options }
+ @photos ||= photo_objs.map {|obj| photo_class.new obj, options }
end
delegate :empty?, to: :photos
def each &block
\ No newline at end of file