Class | FileHandlers::GalleryHandler::GalleryInfo |
In: |
lib/webgen/plugins/filehandlers/gallery.rb
|
Parent: | Object |
Objects of this class represent a whole image gallery and are available in all image gallery page files.
data | [R] | The whole data hash for the image gallery. |
gIndex | [R] | The index for the current gallery or nil if there is no current gallery. |
iIndex | [R] | The index for the current image in the current gallery or nil if there is no current image. |
mainpage | [RW] | The main page object if it exists; otherwise nil. |
# File lib/webgen/plugins/filehandlers/gallery.rb, line 145 145: def initialize( gallery_data, gIndex = nil, iIndex = nil ) 146: @data = gallery_data 147: @gIndex = gIndex 148: @iIndex = iIndex 149: end
Returns the current gallery.
# File lib/webgen/plugins/filehandlers/gallery.rb, line 188 188: def cur_gallery 189: galleries[@gIndex] 190: end
Returns the current image.
# File lib/webgen/plugins/filehandlers/gallery.rb, line 157 157: def cur_image 158: galleries[@gIndex].images[@iIndex] 159: end
Returns the list of gallery objects for this image gallery.
# File lib/webgen/plugins/filehandlers/gallery.rb, line 152 152: def galleries 153: @data[:galleries] 154: end
Returns the next gallery using the given gIndex, if it exists, or nil otherwise.
# File lib/webgen/plugins/filehandlers/gallery.rb, line 198 198: def next_gallery( gIndex = @gIndex ) 199: gIndex != galleries.length - 1 ? galleries[gIndex + 1] : nil 200: end
Returns the next image using the given gIndex and iIndex, if it exists, or nil otherwise.
# File lib/webgen/plugins/filehandlers/gallery.rb, line 175 175: def next_image( gIndex = @gIndex, iIndex = @iIndex ) 176: result = nil 177: if gIndex != galleries.length - 1 || iIndex != galleries[gIndex].images.length - 1 178: if iIndex == galleries[gIndex].images.length - 1 179: result = galleries[gIndex + 1].images[0] 180: else 181: result = galleries[gIndex].images[iIndex + 1] 182: end 183: end 184: return result 185: end
Returns the previous gallery using the given gIndex, if it exists, or nil otherwise.
# File lib/webgen/plugins/filehandlers/gallery.rb, line 193 193: def prev_gallery( gIndex = @gIndex ) 194: gIndex != 0 ? galleries[gIndex - 1] : nil 195: end
Returns the previous image using the given gIndex and iIndex, if it exists, or nil otherwise.
# File lib/webgen/plugins/filehandlers/gallery.rb, line 162 162: def prev_image( gIndex = @gIndex, iIndex = @iIndex ) 163: result = nil 164: if gIndex != 0 || iIndex != 0 165: if iIndex == 0 166: result = galleries[gIndex - 1].images[galleries[gIndex - 1].images.length - 1] 167: else 168: result = galleries[gIndex].images[iIndex - 1] 169: end 170: end 171: return result 172: end