We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Learn more about funding links in repositories.
Report abuse
1 parent 5f5db44 commit 1da9826Copy full SHA for 1da9826
opal/core/module.rb
@@ -366,8 +366,24 @@ def module_eval(&block)
366
end
367
368
alias class_eval module_eval
369
- alias class_exec module_eval
370
- alias module_exec module_eval
+
+ def module_exec(&block)
371
+ %x{
372
+ if (block === nil) {
373
+ throw new Error("no block given");
374
+ }
375
376
+ var block_self = block._s, result;
377
378
+ block._s = null;
379
+ result = block.apply(self, $slice.call(arguments));
380
+ block._s = block_self;
381
382
+ return result;
383
384
+ end
385
386
+ alias class_exec module_exec
387
388
def method_defined?(method)
389
%x{
0 commit comments