class Mhc::Config

Public Class Methods

create_from_file(file_name) click to toggle source
# File lib/mhc/config.rb, line 209
def self.create_from_file(file_name)
  unless File.exists?(File.expand_path(file_name))
    raise Mhc::ConfigurationError, "config file '#{file_name}' not found"
  end
  begin
    return Top.create_from_yaml_file(file_name)
  rescue Psych::SyntaxError, Mhc::Query::ParseError, Mhc::Modifier::ParseError => e
    raise Mhc::ConfigurationError, e.message
  end
end
create_from_string(string) click to toggle source
# File lib/mhc/config.rb, line 220
def self.create_from_string(string)
  begin
    return Top.create_from_yaml_string(string)
  rescue Psych::SyntaxError, Mhc::Query::ParseError, Mhc::Modifier::ParseError => e
    raise Mhc::ConfigurationError, e.message
  end
end