Class: Bijou::Parse::Diagnostics

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDiagnostics

Returns a new instance of Diagnostics.



54
55
56
57
58
59
60
# File 'lib/bijou/diagnostics.rb', line 54

def initialize
  @log = []
  @messages = []
  @messages = []
  @warnings = []
  @errors = []
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



62
63
64
# File 'lib/bijou/diagnostics.rb', line 62

def errors
  @errors
end

#messagesObject (readonly)

Returns the value of attribute messages.



62
63
64
# File 'lib/bijou/diagnostics.rb', line 62

def messages
  @messages
end

#warningsObject (readonly)

Returns the value of attribute warnings.



62
63
64
# File 'lib/bijou/diagnostics.rb', line 62

def warnings
  @warnings
end

Instance Method Details

#add_error(msg) ⇒ Object



74
75
76
77
# File 'lib/bijou/diagnostics.rb', line 74

def add_error(msg)
  @errors.push(msg)
  @log.push(msg)
end

#add_message(msg) ⇒ Object



64
65
66
67
# File 'lib/bijou/diagnostics.rb', line 64

def add_message(msg)
  @messages.push(msg)
  @log.push(msg)
end

#add_warning(msg) ⇒ Object



69
70
71
72
# File 'lib/bijou/diagnostics.rb', line 69

def add_warning(msg)
  @warnings.push(msg)
  @log.push(msg)
end

#textObject



79
80
81
82
83
84
85
86
# File 'lib/bijou/diagnostics.rb', line 79

def text
  result = ''
  @log.each { |s|
    result << s.text
    result << "\n"
  }
  result
end