diff options
author | Alex Legler <alex@a3li.li> | 2014-01-14 17:32:07 +0100 |
---|---|---|
committer | Alex Legler <alex@a3li.li> | 2014-01-14 17:32:07 +0100 |
commit | ef5de35fb5e5b9ccb9119d311dccbe5e926864d4 (patch) | |
tree | f4074e9682536432ec3ab6de1cf5a91152b4e6db /lib | |
parent | Rescue JSON parse failures (diff) | |
download | infra-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.rb | 5 |
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) |