summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2017-01-07 01:12:54 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2017-01-07 01:12:54 -0500
commit7e138622129c96a634b41f99dc552015cbe4b5a6 (patch)
tree8975468b8f3a91edb24880150297d52805ec93f8 /lib
parent90a45f9729f131569889f52cf792007f23df3949 (diff)
Consistently use Time (rather than Date or DateTime).
Diffstat (limited to 'lib')
-rw-r--r--lib/page.rb8
-rw-r--r--lib/page_local.rb6
-rw-r--r--lib/page_remote.rb4
-rw-r--r--lib/sitegen.rb6
4 files changed, 12 insertions, 12 deletions
diff --git a/lib/page.rb b/lib/page.rb
index f269b75..130abdf 100644
--- a/lib/page.rb
+++ b/lib/page.rb
@@ -16,8 +16,8 @@ class Page
#
# def page_categories => String | Enumerable<String>
#
- # def page_published => DateTime | nil
- # def page_updated => DateTime | nil
+ # def page_published => Time | nil
+ # def page_updated => Time | nil
# def page_years => Enumerable<Fixnum>
def atom_categories # => Enumerable<Category>
@@ -31,7 +31,7 @@ class Page
@categories
end
- def atom_published # => DateTime | nil
+ def atom_published # => Time | nil
if @published.nil?
unless page_published.nil?
@published = page_published
@@ -50,7 +50,7 @@ class Page
@published
end
- def atom_updated # => DateTime | nil
+ def atom_updated # => Time | nil
if @updated.nil?
unless page_updated.nil?
@updated = page_updated
diff --git a/lib/page_local.rb b/lib/page_local.rb
index ad4e970..7846a3b 100644
--- a/lib/page_local.rb
+++ b/lib/page_local.rb
@@ -69,13 +69,13 @@ class LocalPage < Page
end
def _gitdates
- @gitdates ||= `git log --format='%cI' -- #{local_infile}`.split("\n").select{|s|!s.empty?}.map{|s|DateTime::iso8601(s)}
+ @gitdates ||= `git log --format='%cI' -- #{local_infile}`.split("\n").select{|s|!s.empty?}.map{|s|DateTime::iso8601(s).to_time}
end
def page_published
if @_published.nil?
raw = _pandoc['published']
- @_published = Datetime::parse(raw) unless raw.nil?
+ @_published = DateTime::parse(raw).to_time unless raw.nil?
end
if @_published.nil?
@_published = _gitdates.sort.first
@@ -86,7 +86,7 @@ class LocalPage < Page
def page_updated
if @_updated.nil?
raw = _pandoc['updated']
- @_updated = DateTime::parse(raw) unless raw.nil?
+ @_updated = DateTime::parse(raw).to_time unless raw.nil?
end
if @_updated.nil?
@updated = _gitdates.sort.last
diff --git a/lib/page_remote.rb b/lib/page_remote.rb
index 87f8207..5425944 100644
--- a/lib/page_remote.rb
+++ b/lib/page_remote.rb
@@ -38,7 +38,7 @@ class RemotePage < Page
if str.nil?
return nil
end
- return Date::parse(str)
+ return DateTime::parse(str).to_time
end
def page_updated
@@ -46,7 +46,7 @@ class RemotePage < Page
if str.nil?
return nil
end
- return Date::parse(str)
+ return DateTime::parse(str).to_time
end
def page_years
diff --git a/lib/sitegen.rb b/lib/sitegen.rb
index c687375..c6e89e9 100644
--- a/lib/sitegen.rb
+++ b/lib/sitegen.rb
@@ -41,13 +41,13 @@ module Sitegen
end
def self.make(target)
- newest = DateTime::new(0)
+ newest = Time::new(0)
(dependencies[target] || []).each do |dep|
- ts = dep.make(dep)
+ ts = make(dep)
newest = ts if ts > newest
end
unless target.is_a?(String)
- return DateTime::now
+ return Time::now
end
if File::exist?(target)
ctime = File::ctime(target)