Sha256: d7ef0a497d3367d5e19f1680f1c41d352f0feaf8703b90f8321d32015eb55592

Contents?: true

Size: 408 Bytes

Versions: 6

Compression:

Stored size: 408 Bytes

Contents

# frozen_string_literal: true

require "yaml"

module ConfigX
  class FileSource < Source
    def initialize(path)
      @path = path
    end

    def load
      if path && File.exist?(path)
        YamlSource.new(File.read(path.to_s)).load
      else
        {}
      end
    end

    def ==(other)
      other.is_a?(self.class) && other.path == path
    end

    protected

    attr_reader :path
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
configx-0.6.0 lib/config_x/file_source.rb
configx-0.5.0 lib/config_x/file_source.rb
configx-0.4.0 lib/config_x/file_source.rb
configx-0.3.0 lib/config_x/file_source.rb
configx-0.2.0 lib/config_x/file_source.rb
configx-0.1.0 lib/config_x/file_source.rb