Class: Begetter::Getter
- Inherits:
-
Object
- Object
- Begetter::Getter
- Defined in:
- lib/begetter/getter.rb
Class Method Summary collapse
-
.get(klass_name) ⇒ Object
generate a class based on a string name and raise Begetter::ClassNotDeclared if the class doesnt exist in the current scope.
Class Method Details
.get(klass_name) ⇒ Object
generate a class based on a string name and raise Begetter::ClassNotDeclared if the class doesnt exist in the current scope
7 8 9 10 11 12 |
# File 'lib/begetter/getter.rb', line 7 def get(klass_name) Object.const_get(klass_name) rescue NameError raise Begetter::ClassNotDeclared, "#{klass_name} does not exist. Did you declare it?" end |