Module: Mcmailer

Defined in:
lib/mcmailer.rb

Constant Summary collapse

VERSION =
"0.0.4"

Class Method Summary collapse

Class Method Details

.configObject



10
11
12
# File 'lib/mcmailer.rb', line 10

def self.config
  @config
end

.configure(opts = {}) ⇒ Object



14
15
16
# File 'lib/mcmailer.rb', line 14

def self.configure(opts={})
  opts.each {|k,v| @config[k] = v if @valid_config_keys.include? k}
end

.configure_with(yaml_file_path) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/mcmailer.rb', line 18

def self.configure_with(yaml_file_path)
  begin
    config = YAML.load_file(yaml_file_path)
  rescue Errno::ENOENT
    log(:error, "YAML configuration file couldn't be found!")
  rescue Psych::SyntaxError
    log(:error, "YAML configuration file contains invalid syntax!")
  end

  configure(config)
end