class Jekyll::GalleryPage
Public Class Methods
new(site, base, dir, name, parent=nil)
click to toggle source
# File lib/jekyll-photo-gallery.rb, line 126 def initialize(site, base, dir, name, parent=nil) @site = site @base = base @dir = dir @name = 'index.html' self.process(@name) # Read template @path = File.realpath(File.join(File.dirname(__FILE__), "jekyll-photo-gallery.html")) self.read_yaml(File.dirname(@path), File.basename(@path)) # Only display root page if parent.nil? name = "Photos" self.data["title"] = name end self.data["title_deferred"] = name self.data["parent"] = parent self.data["photos"] = discover self.data["children"] = [] Jekyll::Hooks.trigger :pages, :post_init, self end
Public Instance Methods
discover()
click to toggle source
# File lib/jekyll-photo-gallery.rb, line 115 def discover photos = [] image_extensions = [".png", ".jpg", ".jpeg", ".gif"] Dir.foreach(@dir) do |item| # Skip files with wrong extension next unless item.downcase().end_with?(*image_extensions) photos << GalleryPhoto.new(@site, @base, @dir, item) end photos end