P
Paul Bergstrom
I have some problems understanding the basics of classes and modules in
Ruby =E2=80=93=C2=A0and arg and options. How do you create a e g class th=
at can take
some options, but leave them out if not needed? This is what I'm
familiar with now, sending along an arg to the method in a module.
module Abc
def self.test(arg)
puts arg
end
end
In this occasion I have to pass along a an arg, or nil, or there will an
error. But how do I design my module so I can pass options, or leave
them out if wanted? Like:
Abc.test
color =3D> 'red') or Abc.test()
-- =
Posted via http://www.ruby-forum.com/.=
Ruby =E2=80=93=C2=A0and arg and options. How do you create a e g class th=
at can take
some options, but leave them out if not needed? This is what I'm
familiar with now, sending along an arg to the method in a module.
module Abc
def self.test(arg)
puts arg
end
end
In this occasion I have to pass along a an arg, or nil, or there will an
error. But how do I design my module so I can pass options, or leave
them out if wanted? Like:
Abc.test
-- =
Posted via http://www.ruby-forum.com/.=