Sha256: 76a211018c807987a3be6a792141503b747a9d262e0c695a1463d054d1a4bd15

Contents?: true

Size: 220 Bytes

Versions: 50

Compression:

Stored size: 220 Bytes

Contents

# the_class_exists? :User => true | flase
# the_class_exists? :Role => true | flase
def the_class_exists?(class_name)
  klass = Module.const_get(class_name)
  return klass.is_a?(Class)
rescue NameError
  return false
end

Version data entries

50 entries across 50 versions & 2 rubygems

Version Path
the_role_api-3.9.0 lib/the_role_api/trash/the_class_exists.rb
the_role_api-3.8.3 lib/the_role_api/trash/the_class_exists.rb
the_role_api-3.8.2 lib/the_role_api/trash/the_class_exists.rb
the_role_api-3.8 lib/the_role_api/trash/the_class_exists.rb
the_role_api-3.7 lib/the_role_api/trash/the_class_exists.rb
the_role_api-3.6 lib/the_role_api/trash/the_class_exists.rb
the_role_api-3.5 lib/the_role_api/trash/the_class_exists.rb
the_role_api-3.0.3 lib/the_role_api/trash/the_class_exists.rb
the_role_api-3.0.2 lib/the_role_api/trash/the_class_exists.rb
the_role_api-3.0.1 lib/the_role_api/trash/the_class_exists.rb
the_role-2.5.4 lib/the_role/the_class_exists.rb
the_role-2.5.3 lib/the_role/the_class_exists.rb
the_role-2.5.2 lib/the_role/the_class_exists.rb
the_role-2.5.1 lib/the_role/the_class_exists.rb
the_role-2.5 lib/the_role/the_class_exists.rb
the_role-2.4 lib/the_role/the_class_exists.rb
the_role-2.3 lib/the_role/the_class_exists.rb
the_role-2.1.1 lib/the_role/the_class_exists.rb
the_role-2.1.0 lib/the_role/the_class_exists.rb
the_role-2.0.4 lib/the_role/the_class_exists.rb