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