Class: ImageGallery::GalleryPage

Inherits:
Jekyll::Page
  • Object
show all
Defined in:
lib/gallery/gallery.rb

Instance Method Summary collapse

Constructor Details

#initialize(site, gallery) ⇒ GalleryPage

Returns a new instance of GalleryPage.



220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
# File 'lib/gallery/gallery.rb', line 220

def initialize(site, gallery)
  @site = site
  @base = site.source

  year = gallery.datetime.year
  month = gallery.datetime.month
  @dir = File.join(*ImageGallery.gallery_path_array(site, year, month))

  @basename = gallery.id
  @ext = '.html'
  @name = "#{@basename}#{@ext}"

  config = ImageGallery._config_with_defaults(site)
  @data = {
    'layout' => 'gallery_page',
    'gallery' => gallery,
    'year' => year,
    'title' => [config['title_prefix'], year, gallery.name].join(" #{config['title_seperator']} "),
  }

  data.default_proc = proc do |_, key|
    site.frontmatter_defaults.find(relative_path, :galleries, key)
  end
end