class Photish::Gallery::Album

Attributes

parent[R]
path[R]

Public Class Methods

new(parent, path) click to toggle source
Calls superclass method Photish::Plugin::Pluginable::new
# File lib/photish/gallery/album.rb, line 17
def initialize(parent, path)
  super
  @parent = parent
  @path = path
end

Public Instance Methods

name() click to toggle source
# File lib/photish/gallery/album.rb, line 23
def name
  @name ||= basename
end
Also aliased as: base_url_name
pages() click to toggle source
# File lib/photish/gallery/album.rb, line 32
def pages
  @pages ||=  child_files.select { |file| page?(file)   }
                         .map    { |file| Page.new(self, file) }
end
photos() click to toggle source
# File lib/photish/gallery/album.rb, line 27
def photos
  @photos ||= child_files.select { |file| image?(file)   }
                         .map    { |file| Photo.new(self, file) }
end
plugin_type() click to toggle source
# File lib/photish/gallery/album.rb, line 37
def plugin_type
  Plugin::Type::Album
end

Private Instance Methods

album_class() click to toggle source
# File lib/photish/gallery/album.rb, line 63
def album_class
  self.class
end
base_url_name()
Alias for: name
child_files() click to toggle source
# File lib/photish/gallery/album.rb, line 48
def child_files
  @child_files ||= Dir.entries(path)
                      .reject { |file| ['.', '..'].include?(file) }
                      .map    { |file| File.join(path, file)      }
                      .select { |file| File.file?(file)           }
end
image?(file) click to toggle source
# File lib/photish/gallery/album.rb, line 55
def image?(file)
  image_extensions.include?(extension_of(file))
end
page?(file) click to toggle source
# File lib/photish/gallery/album.rb, line 59
def page?(file)
  page_extension == extension_of(file)
end
url_end() click to toggle source
# File lib/photish/gallery/album.rb, line 67
def url_end
  'index.html'
end