Class: Class

Inherits:
Module
  • Object
show all
Defined in:
lib/lafcadio/util.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.getClass(className) ⇒ Object

Given a String, returns a class object by the same name.



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/lafcadio/util.rb', line 18

def self.getClass(className)
	theClass = nil
	ObjectSpace.each_object(Class) { |aClass|
		theClass = aClass if aClass.name == className
	}
	if theClass
		theClass
	else
		raise( Lafcadio::MissingError, "Couldn't find class \"#{ className }\"",
		       caller )
	end
end

Instance Method Details

#bareNameObject

Returns the name of aClass itself, stripping off the names of any containing modules or outer classes.



33
34
35
36
# File 'lib/lafcadio/util.rb', line 33

def bareName
	name =~ /::/
	$' || name
end