Sha256: 9be986e89be477cf735e6d01173bb30c603b36d38d18d147fab4629ece9636ba
Contents?: true
Size: 678 Bytes
Versions: 7
Compression:
Stored size: 678 Bytes
Contents
# encoding: utf-8 class Serious::Page < Serious::Article class << self # # Returns all pages # def all @all ||= page_paths.map { |path| new(path) } end def find(permalink) all.find_all {|page| page.permalink == permalink }.first end private # Returns all page files in pages path def page_paths @pages_paths ||= Dir[File.join(Serious.pages, '*')].sort end end def url "/pages/#{permalink}" end private # Will extract the permalink from the filename. def extract_date_and_permalink! @permalink = File.basename(path).split('.')[0...-1].join("") end end
Version data entries
7 entries across 7 versions & 1 rubygems