/lib/icalendar/base.rb

http://github.com/publicdisplay/icalendar · Ruby · 43 lines · 21 code · 8 blank · 14 comment · 0 complexity · 399a66f7b86dbdcb60d24969f6732908 MD5 · raw file

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