« Return to Thread: The simpelest of module function scoping...

The simpelest of module function scoping...

by Tom Verbeure :: Rate this Message:

Reply to Author | View in Thread

It's a little sad that I've written many lines of ruby code, but I
can't something as simple as this to work:

#! /usr/bin/env ruby
module T

   def t(x)
        puts x
   end

   T::t(5)
end

>> ./t.rb

./t.rb:8: undefined method `t' for T:Module (NoMethodError)

Obviously, I've tried different incantations, like t(5), T.t(5) etc.
No sigar...  I must be missing something really trivial...

Tom

 « Return to Thread: The simpelest of module function scoping...