class G5kChecks::ConfigParser

Public Class Methods

new(configpath) click to toggle source
# File lib/g5kchecks/utils/configparser.rb, line 7
def initialize(configpath)
  # The config path
  @path = configpath
  # Hash to be return after the file parsing
  @hash = {}
end

Public Instance Methods

parse() click to toggle source
# File lib/g5kchecks/utils/configparser.rb, line 14
def parse
  begin
    @hash = YAML.load_file(@path)
  rescue ArgumentError
    raise ArgumentError.new("Invalid YAML file '#{@path}'")
  rescue Errno::ENOENT
    raise ArgumentError.new("File not found '#{@path}'")
  end
  return @hash
end