Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

We want to have the timestamps as an instance of Date.

  • Loading branch information...
commit fb6cffaf0d4c28926028e1a5e8345eb59daf04cf 1 parent f6dcf94
James C Russell authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 app/posts.rb
9 app/posts.rb
View
@@ -32,6 +32,13 @@ def title
"#{slug}#{self.metadata[:title]}"
end
+ def initialize(metadata, content, original_path)
+ super
+ year, month, day = File.basename(original_path).slice(0, 10).split("-")
+ metadata[:created_at] = Date.new(year.to_i, month.to_i, day.to_i)
+ metadata[:updated_at] = metadata[:updated_at].to_date
+ end
+
def self.posts
Post.instances.sort do |post, another|
another.metadata[:created_at] <=> post.metadata[:created_at]
@@ -56,7 +63,7 @@ def self.series
end.
each do |key, series|
- series.sort! {|a,b| a.metadata[:created_at] <=> b.metadata[:created_at]}
+ series.sort! { |a,b| a.metadata[:created_at] <=> b.metadata[:created_at] }
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.