We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
This answer certainly works but the idea of turning a class into a string could lead to potential issues down the line and made me a bit uncomfortable.
This worked for me in case anyone is interested:
defidentify_class(obj)caseobjwhenHackerputs"It\'s a Hacker!"whenSubmissionputs"It\'s a Submission!"whenTestCaseputs"It\'s a TestCase!"whenContestputs"It\'s a Contest!"elseputs"It\'s an unknown model"endend
Ruby Control Structures - Case (Bonus Question)
You are viewing a single comment's thread. Return to all comments →
This answer certainly works but the idea of turning a class into a string could lead to potential issues down the line and made me a bit uncomfortable.
This worked for me in case anyone is interested: