R
Ronald Fischer
Usually I work with modules like this:
# Defining a module in one file
module M
def f(x)
....
end
end
# Using the module in another file
require 'M'
include M
f(45)
Sometimes I would find it more convenient to *not* inject
the module's namespace into the user's namespace, i.e. to
do it without the include statement. I thought it would=20
be easy to qualify the foreign function with the module
name:
# Using the module in another file
# (this does not work)
require 'M'
M::f(45) # Error: undefined method 'f'
Maybe I'm thinking to Perlish here. Can it be done what I want
to achieve, and how?
Ronald
--=20
Ronald Fischer <[email protected]>
Phone: +49-89-452133-162
=20
# Defining a module in one file
module M
def f(x)
....
end
end
# Using the module in another file
require 'M'
include M
f(45)
Sometimes I would find it more convenient to *not* inject
the module's namespace into the user's namespace, i.e. to
do it without the include statement. I thought it would=20
be easy to qualify the foreign function with the module
name:
# Using the module in another file
# (this does not work)
require 'M'
M::f(45) # Error: undefined method 'f'
Maybe I'm thinking to Perlish here. Can it be done what I want
to achieve, and how?
Ronald
--=20
Ronald Fischer <[email protected]>
Phone: +49-89-452133-162
=20