Sha256: 97ff5c1308f9e94a429f33f4752655d65f966433e38241dca209c603c559e09d

Contents?: true

Size: 324 Bytes

Versions: 2

Compression:

Stored size: 324 Bytes

Contents

require "yaml"
require "erb"

class EasySettings::YamlSource
  attr_reader :path

  def initialize(path)
    @path = path.to_s
  end

  def load
    File.exist?(path) ? (YAML.load(ERB.new(IO.read(path)).result) || {}) : {}
  rescue StandardError => e
    raise "Error occurred while parsing #{path}: #{e.message}"
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
easy-settings-2.0.2 lib/easy-settings/yaml_source.rb
easy-settings-2.0.1 lib/easy-settings/yaml_source.rb