module Kharon
Main module of the application. @author Vincent Courtois <courtois.vincent@outlook.com>
Constants
- VERSION
Current version of the application.
Public Class Methods
Adds a processor class to the list of processors. @param [Symbol] name the name of the stored processor to retrieve it after. It will be the method you call to process a data with that processor. @param [Class] classname the class object for the processor to be instanciated later.
# File lib/kharon.rb, line 24 def self.add_processor(name, classname) @@processors[name] = classname if classname.ancestors.include? Kharon::Processor end
Returns the current error handler, defined by if you use exceptions or not. @return [Object] an instance of Kharon::Handlers::Exceptions
if you use exceptions, an instance of Kharon::Handlers::Messages
else.
# File lib/kharon.rb, line 17 def self.errors_handler @@use_exceptions ? Kharon::Handlers::Exceptions.instance : Kharon::Handlers::Messages.new end
Checks if a processor currently exists in the system. @param [String] name the name of the processor to check the existence. @return [Boolean] TRUE if the processor exists, FALSE if not.
# File lib/kharon.rb, line 43 def self.has_processor?(name) @@processors.keys.include?(name) end
Getter for the list of processors. @return [Hash] the list of processors currently available.
# File lib/kharon.rb, line 36 def self.processors @@processors end
Removes a processor from the list of available processors. @param [Symbol] name the name (key) of the processor to delete.
# File lib/kharon.rb, line 30 def self.remove_processor(name) @@processors.delete(name) if self.has_processor?(name) end
Configuration method used to tell the module if it uses exceptions or stores error messages. @param [Boolean] use TRUE if you want to use exceptions, FALSE else.
# File lib/kharon.rb, line 11 def self.use_exceptions(use = true) @@use_exceptions = use end