Class: Emissary::Agent::Test

Inherits:
Emissary::Agent show all
Defined in:
lib/emissary/agent/test.rb

Instance Attribute Summary

Attributes inherited from Emissary::Agent

#args, #config, #message, #method, #name, #operator

Instance Method Summary collapse

Methods inherited from Emissary::Agent

#activate, #initialize, #post_init, #send

Constructor Details

This class inherits a constructor from Emissary::Agent

Instance Method Details

#test_raise(klass, *args) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/emissary/agent/test.rb', line 22

def test_raise klass, *args
  ::Emissary.logger.debug "TEST AGENT: #test(#{klass}, #{args.inspect})"

  exception = nil
  begin
    e_klass = ::Emissary.klass_const(klass)
    unless not e_klass.try(:new).try(:is_a?, Exception)
      raise e_klass, *args
    else
      raise Exception, "#{e_klass.name.to_s rescue e_klass.to_s} is not a valid exception name!"
    end
  rescue Exception => e
    exception = e
  end

  message.error exception
end

#valid_methodsObject



18
19
20
# File 'lib/emissary/agent/test.rb', line 18

def valid_methods
  [:test_raise]
end