This is pretty ridiculous, but I have tried
virtually every combination of class and module
definitions that I can think of, all without
success:
I started with an old Post by Ara Howard:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/193039
module Foo
class Main
...
end
end
Foo::Main.run(ARGV, ENV) if __FILE__ == $0
I construed that post to mean that this work:
module Foo
class Main
def run
puts "Running"
end
end
end
Foo::Main.run() if __FILE__ == $0
But the result was:
undefined method `run' for Foo::Main:Class
Then I found the ERB program at
http://stuff.mit.edu/afs/sipb/project/ruby-lang/bin/erb
That one reverses class & module:
class ERB
module Main
def run
puts "Running"
end
end
end
Foo::Main.run if __FILE__ == $0
But I got a similar result:
undefined method `run' for Foo::Main:Module
So I tried with the class definition by itself, and
with the module definition by itself. Nothing worked.
What the heck is wrong with this picture?
(thanks in advance)