I have a Foo
module and I would like to add inside a method ()
(without name) in order to
do:
Foo(“bar”) # => do some stuff…
Just like Array( ... )
and Integer( ... )
. Is it possible?
Thank you.
I have a Foo
module and I would like to add inside a method ()
(without name) in order to
do:
Foo(“bar”) # => do some stuff…
Just like Array( ... )
and Integer( ... )
. Is it possible?
Thank you.
Would the following suffice?
module Kernel
def Foo(arg)
puts arg
end
end
Foo(‘hello’) #=> hello
Oh! okay now I understand thanks to you!
Well, I will avoid polluting the Kernel module with my stuff.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs