Method: Bunto::PostReader#read_publishable

Defined in:
lib/bunto/readers/post_reader.rb

#read_publishable(dir, magic_dir, matcher) ⇒ Object

Read all the files in <source>/<dir>/<magic_dir> and create a new Document object with each one insofar as it matches the regexp matcher.

dir - The String relative path of the directory to read.

Returns nothing.



34
35
36
37
38
39
40
41
42
43
# File 'lib/bunto/readers/post_reader.rb', line 34

def read_publishable(dir, magic_dir, matcher)
  read_content(dir, magic_dir, matcher).tap { |docs| docs.each(&:read) }
    .select do |doc|
      site.publisher.publish?(doc).tap do |will_publish|
        if !will_publish && site.publisher.hidden_in_the_future?(doc)
          Bunto.logger.debug "Skipping:", "#{doc.relative_path} has a future date"
        end
      end
    end
end