Sha256: ac6fd54763b788e5c5f0cecefdfda9fefdf0af9a6a45e791216d2e903f55b3de
Contents?: true
Size: 673 Bytes
Versions: 3
Compression:
Stored size: 673 Bytes
Contents
class TestBenchmarker::ClassNotFoundError < StandardError attr_accessor :class_str def initialize(class_str) @class_str = class_str end end class String # similar to ActiveSupports constantize, but doesn't require the use of active support. 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 end class Class def is_subclass_of?(klass) return false if self == Object && klass != Object return true if self == klass return self.superclass.is_subclass_of?(klass) end end
Version data entries
3 entries across 3 versions & 1 rubygems