Class: BooleanVerifier

Inherits:
Object
  • Object
show all
Defined in:
lib/logix-toolkit/core/boolean_verifier.rb

Overview

The Boolean verifier class, it’s task is to make sure that user input is a boolean otherwise it throws an error

Class Method Summary collapse

Class Method Details

.verify?(object, *more_args) ⇒ Boolean

verifies the validity of a boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/logix-toolkit/core/boolean_verifier.rb', line 7

def self.verify? object, *more_args
  if object == true or object == false
    more_args.each do |i|
      if i == true or i == false
        #Do nothing continue the check unless an invalid argument was found
      else
        ErrorsAndExceptions.object_not_boolean i
      end
    end
    #finally return true
    return true
  else
    ErrorsAndExceptions.object_not_boolean object
  end
end