Module: GenericUtils

Extended by:
GenericUtils
Included in:
GenericUtils, WellRested::Utils
Defined in:
lib/generic_utils.rb

Instance Method Summary collapse

Instance Method Details

#class_exists?(name) ⇒ Boolean

Return whether a class exists for a given name.

Returns:

  • (Boolean)


12
13
14
# File 'lib/generic_utils.rb', line 12

def class_exists?(name)
  get_class(name) != nil
end

#get_class(name) ⇒ Object

Return a class object given its name.



5
6
7
8
9
# File 'lib/generic_utils.rb', line 5

def get_class(name)
  Kernel.const_get(name)
rescue NameError
  nil
end