Skip to content

Commit

Permalink
Fix Module#module_exec to pass arguments to block
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Nov 9, 2013
1 parent 5f5db44 commit 1da9826
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions opal/core/module.rb
Expand Up @@ -366,8 +366,24 @@ def module_eval(&block)
end

alias class_eval module_eval
alias class_exec module_eval
alias module_exec module_eval

def module_exec(&block)
%x{
if (block === nil) {
throw new Error("no block given");
}
var block_self = block._s, result;
block._s = null;
result = block.apply(self, $slice.call(arguments));
block._s = block_self;
return result;
}
end

alias class_exec module_exec

def method_defined?(method)
%x{
Expand Down

0 comments on commit 1da9826

Please sign in to comment.