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

Public Instance Methods

to_s() click to toggle source

Convert the Message into a String.

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

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.