Class: Rutema::Message
- Inherits:
-
Object
- Object
- Rutema::Message
- Defined in:
- lib/rutema/core/framework.rb
Overview
Simple base for classes concerned with message passing to report test progress and failures
This class and its descendants can be utilized as a container for data relevant to tests and their results. Currently they are being emitted by the Engine and Runners instances and consumed by classes within the Reporters module.
Specialized descendants are ErrorMessage and RunnerMessage.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#test ⇒ Object
The test whose execution originated the message.
-
#text ⇒ Object
The text of the message.
-
#timestamp ⇒ Object
The timestamp of the message's creation.
Instance Method Summary collapse
-
#initialize(params) ⇒ Message
constructor
Initialize a new message from data passed in a hash.
-
#to_s ⇒ Object
Convert the instance to a convenient textual representation.
Constructor Details
#initialize(params) ⇒ Message
Initialize a new message from data passed in a hash
The following keys of the hash are being utilized:
:test- the test id/name of the test which originates the message:text- the text of the message:timestamp- most often the timestamp of the creation of the message, defaults toTime.now
35 36 37 38 39 40 |
# File 'lib/rutema/core/framework.rb', line 35 def initialize(params) @test = params.fetch(:test, "") @test ||= "" @text = params.fetch(:text, "") = params.fetch(:timestamp, Time.now) end |
Instance Attribute Details
#test ⇒ Object
The test whose execution originated the message
19 20 21 |
# File 'lib/rutema/core/framework.rb', line 19 def test @test end |
#text ⇒ Object
The text of the message
22 23 24 |
# File 'lib/rutema/core/framework.rb', line 22 def text @text end |
#timestamp ⇒ Object
The timestamp of the message's creation
25 26 27 |
# File 'lib/rutema/core/framework.rb', line 25 def end |
Instance Method Details
#to_s ⇒ Object
Convert the instance to a convenient textual representation
44 45 46 47 48 49 |
# File 'lib/rutema/core/framework.rb', line 44 def to_s msg = "" msg << "#{@test} " unless @test.empty? msg << @text return msg end |