Sha256: 57f0f954aa0de4e5c72a83744823c81f3a5e52a4661921f953fea224c6a96031

Contents?: true

Size: 585 Bytes

Versions: 15

Compression:

Stored size: 585 Bytes

Contents

# frozen_string_literal: true

module Bridgetown
  class DefaultsReader
    attr_reader :site, :path_defaults

    def initialize(site)
      @site = site
      @path_defaults = HashWithDotAccess::Hash.new
    end

    def read
      return unless File.directory?(site.source)

      entries = Dir.chdir(site.source) do
        Dir["**/_defaults.{yaml,yml,json}"]
      end

      entries.each do |entry|
        path = @site.in_source_dir(entry)
        @path_defaults[File.dirname(path) + File::SEPARATOR] = SafeYAML.load_file(path)
      end

      @path_defaults
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
bridgetown-core-0.21.0.beta2 lib/bridgetown-core/readers/defaults_reader.rb
bridgetown-core-0.21.0.beta1 lib/bridgetown-core/readers/defaults_reader.rb
bridgetown-core-0.20.0 lib/bridgetown-core/readers/defaults_reader.rb
bridgetown-core-0.19.3 lib/bridgetown-core/readers/defaults_reader.rb
bridgetown-core-0.19.2 lib/bridgetown-core/readers/defaults_reader.rb
bridgetown-core-0.19.1 lib/bridgetown-core/readers/defaults_reader.rb
bridgetown-core-0.19.0 lib/bridgetown-core/readers/defaults_reader.rb
bridgetown-core-0.18.6 lib/bridgetown-core/readers/defaults_reader.rb
bridgetown-core-0.18.5 lib/bridgetown-core/readers/defaults_reader.rb
bridgetown-core-0.18.4 lib/bridgetown-core/readers/defaults_reader.rb
bridgetown-core-0.18.3 lib/bridgetown-core/readers/defaults_reader.rb
bridgetown-core-0.18.2 lib/bridgetown-core/readers/defaults_reader.rb
bridgetown-core-0.18.1 lib/bridgetown-core/readers/defaults_reader.rb
bridgetown-core-0.18.0 lib/bridgetown-core/readers/defaults_reader.rb
bridgetown-core-0.17.1 lib/bridgetown-core/readers/defaults_reader.rb