From ef5de35fb5e5b9ccb9119d311dccbe5e926864d4 Mon Sep 17 00:00:00 2001 From: Alex Legler Date: Tue, 14 Jan 2014 17:32:07 +0100 Subject: Use proper update times Read the notice's mtime. Just used for the Atom feed right now. --- lib/notice_store.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib') 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) -- cgit v1.2.3-65-gdbad