You want respond_to? which Just Works everywhere.
No, it behaves the same, you will get a respond_to?(foo) false at the
main level.
And really, you
probably don’t even want to be asking if a method is defined (depends
on your code), but usually there are better ways of doing things (like
unit testing).
All truth passes through three stages. First, it is ridiculed. Second,
it is violently opposed. Third, it is accepted as being self-evident.
Schopenhauer (attr.)
You want respond_to? which Just Works everywhere.
No, it behaves the same, you will get a respond_to?(foo) false at the
main level.
And really, you
probably don’t even want to be asking if a method is defined (depends
on your code), but usually there are better ways of doing things (like
unit testing).
All truth passes through three stages. First, it is ridiculed. Second,
it is violently opposed. Third, it is accepted as being self-evident.
Schopenhauer (attr.)
To learn ruby, i 'm trying to developpe a batch from php to ruby. I made
classes easely in ruby, and now i’m coding my main script. In this main
script, i don’t want make a main class, just a code ‘procedural’
(step1, step2 …) with some calls of my classes. In this vision, i’am
trying to do same algorythmy, so i have in php a
function_exists()…and, like a good dog, i do the same in ruby;)
I think in PHPOO for coding in Ruby, probably not the very good way, but
it helps me to translate (i made a function print_r;))
I’m not use OnRail yet, i want know ruby first.
Probably i made some mistakes, but it’s just my second day on ruby…and
it seems i like it;)