summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAlex Legler <alex@a3li.li>2014-01-14 17:32:07 +0100
committerAlex Legler <alex@a3li.li>2014-01-14 17:32:07 +0100
commitef5de35fb5e5b9ccb9119d311dccbe5e926864d4 (patch)
treef4074e9682536432ec3ab6de1cf5a91152b4e6db /lib
parentRescue JSON parse failures (diff)
downloadinfra-status-ef5de35fb5e5b9ccb9119d311dccbe5e926864d4.tar.gz
infra-status-ef5de35fb5e5b9ccb9119d311dccbe5e926864d4.tar.bz2
infra-status-ef5de35fb5e5b9ccb9119d311dccbe5e926864d4.zip
Use proper update times
Read the notice's mtime. Just used for the Atom feed right now.
Diffstat (limited to 'lib')
-rw-r--r--lib/notice_store.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/notice_store.rb b/lib/notice_store.rb
index 77b1edc..1d29fdd 100644
--- a/lib/notice_store.rb
+++ b/lib/notice_store.rb
@@ -69,7 +69,10 @@ end
class Notice
def self.from_file(filename)
content = File.read(filename)
- new(File.basename(filename, '.txt'), YAML.load(content), content.split('---')[2].strip)
+ metadata = YAML.load(content) || {}
+ metadata['updated_at'] = File.mtime(filename)
+
+ new(File.basename(filename, '.txt'), metadata, content.split('---')[2].strip)
end
def [](what)