Sha256: 8b75cd33a888702d933f552a189b887def091f06cac4aec571c39dfd6ffa4f02
Contents?: true
Size: 621 Bytes
Versions: 6
Compression:
Stored size: 621 Bytes
Contents
require 'yaml' require 'active_support/core_ext/hash/indifferent_access' module Pears module Provider # Used for loading simple YAML file locally. class RailsConfig < Base def initialize(*path_parts, on_failure: :raise) file = path_parts.pop file_path = Rails.root.join('config', *path_parts, "#{file}.yml") yaml_data = File.read(file_path) @data = parse_yaml(yaml_data) rescue Errno::ENOENT, Pears::InvalidProviderData => error if on_failure == :null @data = {} else raise error end end end end end
Version data entries
6 entries across 6 versions & 1 rubygems