I am an absolute beginner in Ruby, having trouble understanding when to
use which objects - class, module, proc. I have tried googling the
available documentation but without success.
If I have
mystring = MyApp.call(someargs)
then what sort of thing should MyApp be? An instance of a class? A
module? A proc?
I am an absolute beginner in Ruby, having trouble understanding when to
use which objects - class, module, proc. I have tried googling the
available documentation but without success.
If I have
mystring = MyApp.call(someargs)
then what sort of thing should MyApp be? An instance of a class? A
module? A proc?
Thank you very much
class MyApp
def self.call(arg)
puts arg
end
end
MyApp.call(‘hello’)
–output:–
“hello”
I am an absolute beginner in Ruby, having trouble understanding when to
use which objects - class, module, proc
Use whatever will work. Try them one by one until you come up with
something that works. When you are learning computer programming, you
are learning a series of tricks. You may not know why a trick will be
useful, but as you get more experience, you will start being able to
match the tricks you learned to problems you are trying to solve.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.