Forum: Ruby Extract all case when entries

4828d528e2e46f7c8160c336eb332836?d=identicon&s=25 Robert Heiler (shevegen)
on 2014-07-20 16:29


def foo(i)
  case i
  when 'foo','bar',
  when 'yo'

Is there a simple way to programmatically get all entries of a given
case menu?

So I would get an array like:


14b5582046b4e7b24ab69b7886a35868?d=identicon&s=25 Joel Pearson (virtuoso)
on 2014-07-20 19:03
The only way I could think of to do that would be to read and parse the
text file containing the code. Then it's a bit of regex to isolate the
case statement and pull out the entries.
Please log in before posting. Registration is free and takes only a minute.
Existing account

NEW: Do you have a Google/GoogleMail, Yahoo or Facebook account? No registration required!
Log in with Google account | Log in with Yahoo account | Log in with Facebook account
No account? Register here.