From 5608b3f3d02b49f51cd8ce233ecfa41dad9bfa4e Mon Sep 17 00:00:00 2001 From: Steve Kemp Date: Sat, 24 Nov 2012 14:59:16 +0000 Subject: Added test_type() to return the name this class was registered with. --- lib/custodian/testfactory.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/custodian/testfactory.rb b/lib/custodian/testfactory.rb index 179b050..f5e342d 100644 --- a/lib/custodian/testfactory.rb +++ b/lib/custodian/testfactory.rb @@ -68,6 +68,17 @@ module Custodian end + # + # Get the friendly-type of this class + # + def get_type + @@subclasses.each do |name,value| + if ( value == self.class ) + return name + end + end + nil + end # -- cgit v1.2.1