Sha256: 4dbe4c8b41458a9100e3657725b2ab08ac046f15d24b6011526f2b675d14c984

Contents?: true

Size: 325 Bytes

Versions: 8

Compression:

Stored size: 325 Bytes

Contents

require "yaml"
require "erb"

class EasySettings::YamlSource
  attr_reader :path

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

  def load
    result = 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

8 entries across 8 versions & 1 rubygems

Version Path
easy-settings-2.0.0 lib/easy-settings/yaml_source.rb
easy-settings-1.4.0 lib/easy-settings/yaml_source.rb
easy-settings-1.3.1 lib/easy-settings/yaml_source.rb
easy-settings-1.3.0 lib/easy-settings/yaml_source.rb
easy-settings-1.2.0 lib/easy-settings/yaml_source.rb
easy-settings-1.1.0 lib/easy-settings/yaml_source.rb
easy-settings-1.0.1 lib/easy-settings/yaml_source.rb
easy-settings-1.0.0 lib/easy-settings/yaml_source.rb