class MailCannon::Event

Manages the mailing Events, very tricky.

Constants

EVENTS

Public Class Methods

from_code(code) click to toggle source
# File lib/mailcannon/event.rb, line 37
def self.from_code(code)
  raise 'code must be an Integer or String!' unless code.is_a?(Integer)||code.is_a?(String)
  if code.is_a?(Integer)
    return eval_module(EVENTS[code])
  else
    return eval_module(code)
  end
end

Private Class Methods

eval_module(code) click to toggle source
# File lib/mailcannon/event.rb, line 47
def self.eval_module(code)
  if EVENTS.include?(code)
    return eval("MailCannon::Event::#{code.camelize}")
  else
    raise "invalid code. Use one of the following: #{EVENTS}"
  end
end