Parent

Methods

Class Index [+]

Quicksearch

TaskJuggler::Message

The Message object can store several classes of messages that the application can send out.

Attributes

type[R]
id[R]
message[R]
sourceFileInfo[R]
line[R]

Public Class Methods

new(type, id, message, sourceFileInfo, line, data, scenario) click to toggle source

Create a new Message object. The type specifies what tpye of message this is. The following types are supported: fatal, error, warning, info and debug. id is a String that must uniquely identify the source of the Message. message is a String with the actual message. sourceLineInfo is a SourceLineInfo object that can reference a location in a specific file. line is a String of that file. data can be any context sensitive data. sceneario specifies the Scenario in which the message originated.

    # File lib/MessageHandler.rb, line 29
29:     def initialize(type, id, message, sourceFileInfo, line, data, scenario)
30:       unless [ :fatal, :error, :warning, :info, :debug ].
31:              include?(type)
32:         raise "Unknown message type: #{type}"
33:       end
34:       @type = type
35: 
36:       @id = id
37: 
38:       if message && !message.is_a?(String)
39:         raise "String object expected as message but got #{message.class}"
40:       end
41:       @message = message
42: 
43:       if sourceFileInfo && !sourceFileInfo.is_a?(SourceFileInfo)
44:         raise "SourceFileInfo object expected but got #{sourceFileInfo.class}"
45:       end
46:       @sourceFileInfo = sourceFileInfo
47: 
48:       if line && !line.is_a?(String)
49:         raise "String object expected as line but got #{line.class}"
50:       end
51:       @line = line
52: 
53:       @data = data
54: 
55:       if scenario && !scenario.is_a?(Scenario)
56:         raise "Scenario object expected by got #{scenario.class}"
57:       end
58:       @scenario = scenario
59:     end

Public Instance Methods

to_s() click to toggle source

Convert the Message into a String.

    # File lib/MessageHandler.rb, line 62
62:     def to_s
63:       str = ""
64:       # The SourceFileInfo is printed as <fileName>:line:
65:       if @sourceFileInfo
66:         str += "#{@sourceFileInfo.fileName}:#{sourceFileInfo.lineNo}: "
67:       end
68:       if @scenario
69:         str += "#{@type.to_s.capitalize} in scenario #{@scenario.id}: "
70:       else
71:         str += "#{@type.to_s.capitalize}: "
72:       end
73:       str += @message
74:       str += "\n" + @line if @line
75:       str
76:     end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.