rf-web/vendor/bundle/gems/jekyll-4.0.0/lib/jekyll/publisher.rb

24 lines
471 B
Ruby
Raw Normal View History

2019-10-21 08:18:17 +00:00
# frozen_string_literal: true
module Jekyll
class Publisher
def initialize(site)
@site = site
end
def publish?(thing)
can_be_published?(thing) && !hidden_in_the_future?(thing)
end
def hidden_in_the_future?(thing)
thing.respond_to?(:date) && !@site.future && thing.date.to_i > @site.time.to_i
end
private
def can_be_published?(thing)
thing.data.fetch("published", true) || @site.unpublished
end
end
end