Class: Envm::ParserFactory

Inherits:
Object
  • Object
show all
Defined in:
lib/envm/parser.rb

Class Method Summary collapse

Class Method Details

.parser(filepath) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/envm/parser.rb', line 6

def self.parser(filepath)
  unless File.exist?(filepath)
    fail FileNotFoundError, "#{filepath} does not exist."
  end

  if filepath.include?(".yml")
    YamlParser.new(filepath)
  else
    fail FileTypeNotSupportedError, "File type is not supported: #{filepath}."
  end
end