summaryrefslogtreecommitdiff
path: root/tool/lrama/lib/lrama/warning.rb
blob: 3c99791ebf81dc10e6b5fe9278aec2ad058d2931 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
module Lrama
  class Warning
    attr_reader :errors, :warns

    def initialize(out = STDERR)
      @out = out
      @errors = []
      @warns = []
    end

    def error(message)
      @out << message << "\n"
      @errors << message
    end

    def warn(message)
      @out << message << "\n"
      @warns << message
    end

    def has_error?
      !@errors.empty?
    end
  end
end