diff options
author | Steve Kemp <steve@steve.org.uk> | 2015-04-16 16:36:44 +0100 |
---|---|---|
committer | Steve Kemp <steve@steve.org.uk> | 2015-04-16 16:36:44 +0100 |
commit | f4efd8eb3373cd22ca1442bb215b8ebd240f8fb1 (patch) | |
tree | dfa03804be82e242179bf249b6dc567901180603 /lib/custodian/testfactory.rb | |
parent | 16780d629fff237e0b89c8ae9be00dc41f6e7a67 (diff) |
Test our enum-like type works as expected.
Specifically that we can get the value back as a string, and
work with the ordinal too.
Diffstat (limited to 'lib/custodian/testfactory.rb')
-rw-r--r-- | lib/custodian/testfactory.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/custodian/testfactory.rb b/lib/custodian/testfactory.rb index 29d1f99..0f5a30d 100644 --- a/lib/custodian/testfactory.rb +++ b/lib/custodian/testfactory.rb @@ -15,6 +15,18 @@ module Custodian TEST_PASSED = 2 TEST_FAILED = 4 TEST_SKIPPED = 8 + + + # + # Allow one of our symbols to be converted back + # + def self.to_str(status) + for sym in self.constants + if self.const_get(sym) == status + return sym.to_s + end + end + end end |