Class: CodeMessage
Overview
warnings and errors from code compilation
Instance Attribute Summary collapse
-
#colnumber ⇒ Object
readonly
Returns the value of attribute colnumber.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#linenumber ⇒ Object
readonly
Returns the value of attribute linenumber.
-
#message ⇒ Object
Returns the value of attribute message.
-
#messagetype ⇒ Object
readonly
Returns the value of attribute messagetype.
Instance Method Summary collapse
-
#<=>(other) ⇒ Boolean
Checks if two CodeMessage objects are different.
-
#eql?(other) ⇒ Boolean
Checks if two CodeMessage objects are equal.
- #error? ⇒ Boolean
- #hash ⇒ Object
-
#initialize(filename, linenumber, colnumber, messagetype, message) ⇒ CodeMessage
constructor
A new instance of CodeMessage.
- #inspect ⇒ Object
-
#warning? ⇒ Boolean
Checks if this instance constitutes a warning.
Constructor Details
#initialize(filename, linenumber, colnumber, messagetype, message) ⇒ CodeMessage
Returns a new instance of CodeMessage
9 10 11 12 13 14 15 |
# File 'lib/codemessage.rb', line 9 def initialize(filename, linenumber, colnumber, , ) @filename = filename @linenumber = linenumber @colnumber = colnumber @messagetype = @message = end |
Instance Attribute Details
#colnumber ⇒ Object (readonly)
Returns the value of attribute colnumber
6 7 8 |
# File 'lib/codemessage.rb', line 6 def colnumber @colnumber end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename
6 7 8 |
# File 'lib/codemessage.rb', line 6 def filename @filename end |
#linenumber ⇒ Object (readonly)
Returns the value of attribute linenumber
6 7 8 |
# File 'lib/codemessage.rb', line 6 def linenumber @linenumber end |
#message ⇒ Object
Returns the value of attribute message
7 8 9 |
# File 'lib/codemessage.rb', line 7 def @message end |
#messagetype ⇒ Object (readonly)
Returns the value of attribute messagetype
6 7 8 |
# File 'lib/codemessage.rb', line 6 def @messagetype end |
Instance Method Details
#<=>(other) ⇒ Boolean
Checks if two CodeMessage objects are different
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/codemessage.rb', line 50 def <=>(other) f = @filename <=> other.filename l = @linenumber.to_i <=> other.linenumber.to_i c = @colnumber.to_i <=> other.colnumber.to_i mt = @messagetype <=> other. m = @message[0..10] <=> other.[0..10] if f != 0 f elsif l != 0 l elsif c != 0 c elsif mt != 0 mt else m end end |
#eql?(other) ⇒ Boolean
Checks if two CodeMessage objects are equal
42 43 44 |
# File 'lib/codemessage.rb', line 42 def eql?(other) (self <=> other).zero? end |
#error? ⇒ Boolean
24 25 26 |
# File 'lib/codemessage.rb', line 24 def error? @messagetype =~ /.*err.*/i end |
#hash ⇒ Object
34 35 36 |
# File 'lib/codemessage.rb', line 34 def hash inspect.hash end |
#inspect ⇒ Object
28 29 30 31 32 |
# File 'lib/codemessage.rb', line 28 def inspect hash = {} instance_variables.each { |var| hash[var.to_s.delete('@')] = instance_variable_get(var) } hash end |
#warning? ⇒ Boolean
Checks if this instance constitutes a warning
20 21 22 |
# File 'lib/codemessage.rb', line 20 def warning? @messagetype =~ /.*warn.*/i end |