Sha256: c1523660ce0f8f6323c2a85d0a146c53cacbccd65c6ac55f8a96eceba21dfdfc

Contents?: true

Size: 719 Bytes

Versions: 9

Compression:

Stored size: 719 Bytes

Contents

# frozen_string_literal: true

module Bridgetown
  # TODO: to be retired once the Resource engine is made official
  class PageReader
    attr_reader :site, :dir, :unfiltered_content

    def initialize(site, dir)
      @site = site
      @dir = dir
      @unfiltered_content = []
    end

    # Create a new `Bridgetown::Page` object for each entry in a given array.
    #
    # files - An array of file names inside `@dir`
    #
    # Returns an array of publishable `Bridgetown::Page` objects.
    def read(files)
      files.each do |page|
        @unfiltered_content << Page.new(@site, @site.source, @dir, page)
      end
      @unfiltered_content.select { |page| site.publisher.publish?(page) }
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
bridgetown-core-0.21.5 lib/bridgetown-core/readers/page_reader.rb
bridgetown-core-0.21.4 lib/bridgetown-core/readers/page_reader.rb
bridgetown-core-0.21.3 lib/bridgetown-core/readers/page_reader.rb
bridgetown-core-0.21.2 lib/bridgetown-core/readers/page_reader.rb
bridgetown-core-0.21.1 lib/bridgetown-core/readers/page_reader.rb
bridgetown-core-0.21.0 lib/bridgetown-core/readers/page_reader.rb
bridgetown-core-0.21.0.beta4 lib/bridgetown-core/readers/page_reader.rb
bridgetown-core-0.21.0.beta3 lib/bridgetown-core/readers/page_reader.rb
bridgetown-core-0.21.0.beta2 lib/bridgetown-core/readers/page_reader.rb