Class: Bijou::Parse::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/bijou/diagnostics.rb

Direct Known Subclasses

Error, Warning

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMessage

Returns a new instance of Message.



12
13
14
15
16
17
# File 'lib/bijou/diagnostics.rb', line 12

def initialize
  @line = nil
  @column = nil
  @prefix = nil
  @text = ''
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



19
20
21
# File 'lib/bijou/diagnostics.rb', line 19

def column
  @column
end

#lineObject (readonly)

Returns the value of attribute line.



19
20
21
# File 'lib/bijou/diagnostics.rb', line 19

def line
  @line
end

Instance Method Details

#<<(s) ⇒ Object



26
27
28
# File 'lib/bijou/diagnostics.rb', line 26

def <<(s)
  @text << s.to_s
end

#at(line, column) ⇒ Object



21
22
23
24
# File 'lib/bijou/diagnostics.rb', line 21

def at(line, column)
  @line = line
  @column = column
end

#textObject



30
31
32
33
34
35
36
# File 'lib/bijou/diagnostics.rb', line 30

def text
  result = ''
  result << @prefix if @prefix
  result << "(#{@line}, #{@column || 0})" if @line
  result << ": " + @text
  result
end