Class: ConfigX::FileSource

Inherits:
Source
  • Object
show all
Defined in:
lib/config_x/file_source.rb

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ FileSource

Returns a new instance of FileSource.



7
8
9
# File 'lib/config_x/file_source.rb', line 7

def initialize(path)
  @path = path
end

Instance Method Details

#==(other) ⇒ Object



19
20
21
# File 'lib/config_x/file_source.rb', line 19

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

#loadObject



11
12
13
14
15
16
17
# File 'lib/config_x/file_source.rb', line 11

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