Method: Module#initialize
- Defined in:
- object.c
#new ⇒ Object #new {|mod| ... } ⇒ Object
Creates a new anonymous module. If a block is given, it is passed the module object, and the block is evaluated in the context of this module using module_eval.
Fred = Module.new do
def meth1
"hello"
end
def meth2
"bye"
end
end
a = "my string"
a.extend(Fred) #=> "my string"
a.meth1 #=> "hello"
a.meth2 #=> "bye"
1490 1491 1492 |
# File 'object.c', line 1490
static VALUE
rb_mod_initialize(module)
VALUE module;
|