Sha256: b3b609ebcd0965d1f88141ce16f22ae1b549e133e8d55ab9eb5b8529d2837be9

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

    private

    def can_be_published?(thing)
      thing.data.fetch('published', true) || @site.unpublished
    end

    def hidden_in_the_future?(thing)
      thing.respond_to?(:date) && !@site.future && thing.date.to_i > @site.time.to_i
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bunto-2.0.0.pre lib/bunto/publisher.rb
bunto-1.0.0 lib/bunto/publisher.rb