Module: Kharon

Defined in:
lib/kharon.rb,
lib/kharon/errors.rb,
lib/kharon/version.rb,
lib/kharon/handlers.rb,
lib/kharon/validator.rb,
lib/kharon/errors/validation.rb,
lib/kharon/handlers/messages.rb,
lib/kharon/handlers/exceptions.rb

Overview

Main module of the application.

Author:

Defined Under Namespace

Modules: Errors, Handlers Classes: Validator

Constant Summary

VERSION =

Current version of the application.

"1.1.0"
@@use_exceptions =
true

Class Method Summary (collapse)

Class Method Details

+ (Object) errors_handler

Returns the current error handler, defined by if you use exceptions or not.

Returns:

  • (Object)

    an instance of Kharon::Handlers::Exceptions if you use exceptions, an instance of Kharon::Handlers::Messages else.



17
18
19
# File 'lib/kharon.rb', line 17

def self.errors_handler
  @@use_exceptions ? Kharon::Handlers::Exceptions.instance : Kharon::Handlers::Messages.new
end

+ (Object) use_exceptions(use = true)

Configuration method used to tell the module if it uses exceptions or stores error messages.

Parameters:

  • use (Boolean) (defaults to: true)

    TRUE if you want to use exceptions, FALSE else.



11
12
13
# File 'lib/kharon.rb', line 11

def self.use_exceptions(use = true)
  @@use_exceptions = use
end