summaryrefslogtreecommitdiff
path: root/lib/page_remote.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/page_remote.rb')
-rw-r--r--lib/page_remote.rb56
1 files changed, 56 insertions, 0 deletions
diff --git a/lib/page_remote.rb b/lib/page_remote.rb
new file mode 100644
index 0000000..a754af6
--- /dev/null
+++ b/lib/page_remote.rb
@@ -0,0 +1,56 @@
+# coding: utf-8
+require 'date'
+
+require 'config'
+require 'page'
+require 'tag'
+
+class RemotePage < Page
+ def initialize(metadata)
+ @metadata = metadata
+ end
+
+ def url
+ return Config::get.url + @metadata['url']
+ end
+
+ def title
+ @metadata['title']
+ end
+
+ def author
+ Person::new(@metadata['author'] || Config::get.default_author)
+ end
+
+ def content
+ return nil
+ end
+
+ def rights
+ return nil
+ end
+
+ def _tags
+ @metadata['tags'] || []
+ end
+
+ def _published
+ str = @metadata['published']
+ if str.nil?
+ return nil
+ end
+ return Date::parse(str)
+ end
+
+ def _updated
+ str = @metadata['updated']
+ if str.nil?
+ return nil
+ end
+ return Date::parse(str)
+ end
+
+ def _years
+ return []
+ end
+end