summaryrefslogtreecommitdiff
path: root/lib/page.rb
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2017-01-06 23:18:24 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2017-01-06 23:18:24 -0500
commit4a3a404a5cb2a8d5be83e28cec5c539928fa30f4 (patch)
treeb6f636ba3ed0ce486941b1b9ad67cb0973699d6b /lib/page.rb
parent7edb003cd1c9b53ffdff11ef85532e39f08db16d (diff)
aaaah
Diffstat (limited to 'lib/page.rb')
-rw-r--r--lib/page.rb56
1 files changed, 28 insertions, 28 deletions
diff --git a/lib/page.rb b/lib/page.rb
index d0b18ef..64bbaea 100644
--- a/lib/page.rb
+++ b/lib/page.rb
@@ -1,7 +1,7 @@
# coding: utf-8
require 'set'
-require 'tag'
+require 'category'
class Page
# Page is an abstract class.
@@ -9,54 +9,54 @@ class Page
# Implementors must implement several methods:
#
# def url => URI
- # def title => String
- # def author => Person
- # def content => html | nil
- # def rights => html | nil
+ # def atom_title => String
+ # def atom_author => Person
+ # def atom_content => html | nil
+ # def atom_rights => html | nil
#
- # def _tags => String | Enumerable<String>
+ # def page_categories => String | Enumerable<String>
#
- # def _published => DateTime | nil
- # def _updated => DateTime | nil
- # def _years => Enumerable<Fixnum>
+ # def page_published => DateTime | nil
+ # def page_updated => DateTime | nil
+ # def page_years => Enumerable<Fixnum>
- def tags # => Enumerable<Tag>
- if @tags.nil?
- raw = _tags
+ def atom_categories # => Enumerable<Category>
+ if @categories.nil?
+ raw = page_categories
if raw.is_a?(String)
raw = raw.split
end
- @tags = raw.map{|tag|Tag.new(tag)}
+ @categories = raw.map{|abbr|Category.new(abbr)}
end
- @tags
+ @categories
end
- def published # => DateTime | nil
+ def atom_published # => DateTime | nil
if @published.nil?
- unless _published.nil?
- @published = _published
+ unless page_published.nil?
+ @published = page_published
else
- unless _updated.nil?
- @published = _updated
+ unless page_updated.nil?
+ @published = page_updated
end
end
# sanity check
- unless _published.nil? or _updated.nil?
- if _updated < _published
- @published = _updated
+ unless page_published.nil? or page_updated.nil?
+ if page_updated < page_published
+ @published = page_updated
end
end
end
@published
end
- def updated # => DateTime | nil
+ def atom_updated # => DateTime | nil
if @updated.nil?
- unless _updated.nil?
- @updated = _updated
+ unless page_updated.nil?
+ @updated = page_updated
else
- unless _published.nil?
- @updated = _published
+ unless page_published.nil?
+ @updated = page_published
end
end
end
@@ -71,7 +71,7 @@ class Page
first = published.year
last = updated.year
- years = _years
+ years = page_years
years.add(first)
years.add(last)