Class: Class
- Inherits:
-
Module
- Object
- Module
- Class
- Defined in:
- lib/lafcadio/util.rb
Class Method Summary collapse
-
.getClass(className) ⇒ Object
Given a String, returns a class object by the same name.
Instance Method Summary collapse
-
#bareName ⇒ Object
Returns the name of
aClass
itself, stripping off the names of any containing modules or outer classes.
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
#bareName ⇒ Object
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 name =~ /::/ $' || name end |