Sha256: 297a0de9ff4e365af4c4923835481a98a4e4ef1d0203288e9a57a603369e4c13

Contents?: true

Size: 460 Bytes

Versions: 2

Compression:

Stored size: 460 Bytes

Contents

module Bunto
  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 & 1 rubygems

Version Path
bunto-3.4.5 lib/bunto/publisher.rb
bunto-3.2.1 lib/bunto/publisher.rb