Working with anonymous modules in Ruby
Posted
by Byron Park
on Stack Overflow
See other posts from Stack Overflow
or by Byron Park
Published on 2010-05-21T15:18:39Z
Indexed on
2010/05/21
15:20 UTC
Read the original article
Hit count: 349
Suppose I make a module as follows:
m = Module.new do
class C
end
end
Three questions:
Other than a reference to
m
, is there a way I can accessC
and other things insidem
?Can I give a name to the anonymous module after I've created it (just as if I'd typed "module ...")?
How do I delete the anonymous module when I'm done with it, such that the constants it defines are no longer present?
© Stack Overflow or respective owner