Am 03.02.2013 09:45, schrieb Steve Tu:
> I am following a tutorial, so am picking up each example as is. I am
> then trying to modify those examples (on a limited basis), just to make
> sure I understand the lesson and what it implies. I may revisit older
> examples if I see a new facility that I think applies - as here, where I
> thought I could bypass my menu and use the passed arguments to
> dynamically call the tutorial lesson.
> I just get a bit lost as to Ruby's built in methods and what they're
> meant to do (I can see WHAT they do, but the implication of
> when/where/why sometimes loses me). Here, for example, you can see if a
> method is available by respond_to? and eval and send will then execute a
> 'prepared' string as a method. But if I can't tell what the footprint is
> of the method what is the point in being able to dynamically execute a
> method (ie I could end up calling a methods as blah() when it should be
> called as blah(int, string, int))? What then is dynamic method execution
> for, if I can't tell how the method is to be called in detail?

As I mentioned, one approach could be to use an argument hash.
But: I think as a novice you should postpone metaprogramming
(constructing method names etc.) for some time.

First thing you should do is to drop the 'global' methods
and start learning about classes.


-- 
<https://github.com/stomar/>