def enter_menu
case @i
when ‘list_cars’,‘lc’
list_cars
when ‘list_horses’,‘lh’
list_horses
when ‘list_plants’,'lp
list_plants
when ‘help’
show_help
end
end
Now, inside the method show_help, I would like to
call the FIRST entry on each case menu.
I.e: list_cars list_horses and list_plants
Is there a way to do this easily?
The actual case menu is very very long, with multiple aliases.
But the main name of every when entry is always the first entry.
In other words I would need a way to programmatically access the
first option of every when clause.
A better way would probably be:
self.class.public_instance_methods(false)
Hmm actually, you gave me a very good idea. I will probably toy a little
bit with that - I could follow with a convention of methods for
instance, or otherwise denote primary methods. Thanks Ryan!
By the way, also thanks to you Yossef M… Even if I initially
disliked your suggestion, I will continue to play with it and test it
slowly (which may help me to convince myself that it may not be so ugly
as it appears to be on first glance).