Module: Rutema::Messaging
- Included in:
- Engine, Runners::Default
- Defined in:
- lib/rutema/core/framework.rb
Overview
Mix-in module which offers an interface to push messages to a queue
Instances of the class including this module need a @queue member variable.
Instance Method Summary collapse
-
#error(identifier, message) ⇒ Object
Push a new ErrorMessage instance to the queue.
-
#message(message) ⇒ Object
Push a new Message or RunnerMessage instance to the queue.
Instance Method Details
#error(identifier, message) ⇒ Object
Push a new ErrorMessage instance to the queue
identifier- in most cases this would be the name of a test or its specification filemessage- a short descriptive message detailing the error condition
156 157 158 |
# File 'lib/rutema/core/framework.rb', line 156 def error(identifier, ) @queue.push(ErrorMessage.new(:test => identifier, :text => , :timestamp => Time.now)) end |
#message(message) ⇒ Object
Push a new Message or RunnerMessage instance to the queue
If message is of type String a Message instance will be pushed to the
queue. If it's of type Hash it will be passed to the initializer of
RunnerMessage if it has both the keys :test and "status" or to the
initializer of Message if not so.
167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/rutema/core/framework.rb', line 167 def () case when String @queue.push(Message.new(:text => , :timestamp => Time.now)) when Hash hm = Message.new() hm = RunnerMessage.new() if [:test] && ["status"] hm. = Time.now @queue.push(hm) end end |