Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/test_benchmarker/core_ext.rb
Instance Method Summary collapse
-
#to_class ⇒ Object
similar to ActiveSupports constantize, but doesn’t require the use of active support.
Instance Method Details
#to_class ⇒ Object
similar to ActiveSupports constantize, but doesn’t require the use of active support.
10 11 12 13 14 15 16 |
# File 'lib/test_benchmarker/core_ext.rb', line 10 def to_class ObjectSpace.each_object(Class) do |klass| return klass if klass.to_s == self end raise TestBenchmarker::ClassNotFoundError.new(self), "A class matching '#{self}' could not be found" end |