Sha256: 4b8db0ee1c49abe63935597d3d87912bb6658c7c546dc1913923ac978fa22e5a
Contents?: true
Size: 891 Bytes
Versions: 2
Compression:
Stored size: 891 Bytes
Contents
# coding: utf-8 module Retter::Page module ViewHelper include Retter::Stationery def entry_path(*args) case args.first when Date, Time date, id = *args date.strftime('/entries/%Y%m%d.html') + (id ? "##{id}" : '') when Retter::Entry entry = args.first entry_path(entry.date) else raise TypeError, "wrong argument type #{args.first.class} (expected Date, Time or Retter::Entry)" end end def article_path(*args) case args.first when Date, Time date, id = *args date.strftime("/entries/%Y%m%d/#{id}.html") when Retter::Entry::Article article = args.first article_path(article.entry.date, article.id) else raise TypeError, "wrong argument type #{args.first.class} (expected Date, Time or Retter::Entry::Article)" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
retter-0.1.2 | lib/retter/page/view_helper.rb |
retter-0.1.1 | lib/retter/page/view_helper.rb |