Method: Ircbot::Client::Config.read

Defined in:
lib/ircbot/client/config.rb

.read(path) ⇒ Object

Reader



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ircbot/client/config.rb', line 8

def self.read(path)
  path = Pathname(path)
  ext  = path.extname.delete(".")
  ext  = "yml" if ext.empty?

  reader = "read_#{ext}"
  if respond_to?(reader)
    Mash.new(__send__(reader, path))
  else
    raise NotImplementedError, "Cannot read #{path}: Format(#{ext})is not supported"
  end
end