Module question

Hey,

I have been looking around about Module etc… and all I can read is
that Module cannot be instantiated. However the following code works
just fine with Ruby 1.8.7:

==
mod = Module.new

Am I missing something obvious?

Thanks,

On Mar 1, 2011, at 23:46 , JP Billaud wrote:

Am I missing something obvious?
Kinda…

class X; end
=> nil

X.new
=> #<X:0x10038cb78>

Y = Class.new
=> Y

Y.new
=> #<Y:0x100359c28>

Class.new
=> #Class:0x100388b90

Class.new.new
=> #<#Class:0x100365028:0x100364f10>

vs:

Z = Module.new
=> Z

Module.new
=> #Module:0x100380e90

Z.new
NoMethodError: undefined method `new’ for Z:Module
from (irb):11

Module.new.new
NoMethodError: undefined method `new’ for #Module:0x10036f848
from (irb):6

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs