PageRenderTime 14ms CodeModel.GetById 11ms app.highlight 2ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/icalendar/base.rb

http://github.com/publicdisplay/icalendar
Ruby | 43 lines | 21 code | 8 blank | 14 comment | 0 complexity | 399a66f7b86dbdcb60d24969f6732908 MD5 | raw file
Possible License(s): GPL-2.0
 1=begin
 2  Copyright (C) 2005 Jeff Rose
 3
 4  This library is free software; you can redistribute it and/or modify it
 5  under the same terms as the ruby language itself, see the file COPYING for
 6  details.
 7=end
 8require 'logger'
 9
10module Icalendar #:nodoc:
11
12  # A simple error class to differentiate iCalendar library exceptions
13  # from ruby language exceptions or others.
14  class IcalendarError < StandardError #:nodoc:
15  end
16
17  # Exception used when the library encounters a bogus calendar component.
18  class UnknownComponentClass < IcalendarError
19  end
20
21  # Exception used when the library encounters a bogus property type.
22  class UnknownPropertyMethod< IcalendarError
23  end
24
25  # Exception used when the library encounters a bogus property value.
26  class InvalidPropertyValue < IcalendarError
27  end
28
29  # This class serves as the base class for just about everything in
30  # the library so that the logging system can be configured in one place.
31  class Base
32    @@logger = Logger.new(STDERR)
33    @@logger.level = Logger::FATAL
34
35    def self.debug
36      @@logger.level = Logger::DEBUG
37    end
38
39    def self.quiet
40      @@logger.level = Logger::FATAL
41    end
42  end
43end