Hi,
I’m verry new to ruby, just use it for some days now and I have question
about the best implementation of how to deal with command line options.
Suppose I have a program, with a class say A and a main.
My program also has a verbose option (program --verbose).
What’s the best way to implement the verbose option in a OO-way?
a) give the boolean verbose to the class and let the class control it.
(method(verbose) --> puts “something” if verbose)
b) run the program and let the main handle with the verbose option.
c) something else
A second question about this is suppose my program runs a loop for a
number of times and the user may specify the number of loops to make,
and if the program must run to the end in once or ask for user action
every x steps)
like: program --loops 50 --steps 5 --> this would ask for user input
every 5yt steps and loops 50 times.
What’s the best way to do this?
a) again let the class handle it (a method run(number_of_loops, steps))
b) or let the main handle it (in the class just a method step() and in
the main the method run(number_of_loops, steps))
c) something else
I hope you understand my problem
Thanks,
Thomas