Module: Toto::PageHelpers
Instance Method Summary collapse
- #archives(filter = "") ⇒ Object
- #articles(ext = ) ⇒ Object
- #import(file) ⇒ Object
- #root ⇒ Object
- #title ⇒ Object
Methods included from ConfigHelpers
Instance Method Details
#archives(filter = "") ⇒ Object
68 69 70 71 72 73 74 75 |
# File 'lib/toto.rb', line 68 def archives filter = "" entries = ! self.articles.empty?? self.articles.select do |a| filter !~ /^\d{4}/ || a.path =~ /^\/#{filter}/ end : [] return Archives.new(entries, @config) end |
#articles(ext = ) ⇒ Object
81 82 83 84 85 |
# File 'lib/toto.rb', line 81 def articles ext = self[:ext] Dir["#{Paths[:articles]}/*.#{ext}"].map do |article| Article.new article, @config end end |
#import(file) ⇒ Object
91 92 93 94 |
# File 'lib/toto.rb', line 91 def import(file) file = "#{Paths[:templates]}/#{file}" unless file =~ /^#{Paths[:templates]}/ ERB.new(File.read(file)).result(binding) end |
#title ⇒ Object
77 78 79 |
# File 'lib/toto.rb', line 77 def title self[:title] end |