Sha256: 51e129f38da41b6657e438dd3edd93a1514f817e59414ebea41e7bdc16c0c0b9

Contents?: true

Size: 494 Bytes

Versions: 2

Compression:

Stored size: 494 Bytes

Contents

# 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

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
jekyll-4.2.1 lib/jekyll/publisher.rb
ngage-0.0.0 lib/ngage/jekyll/publisher.rb