Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opal/opal
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: b0ae678c4d3d
Choose a base ref
...
head repository: opal/opal
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7b56fb271028
Choose a head ref
  • 3 commits
  • 1 file changed
  • 1 contributor

Commits on Nov 4, 2013

  1. Cleanup Kernel#methods

    meh committed Nov 4, 2013
    Copy the full SHA
    90c33cd View commit details
  2. Copy the full SHA
    82440a4 View commit details

Commits on Nov 5, 2013

  1. Cleanup Kernel#loop

    meh committed Nov 5, 2013
    Copy the full SHA
    7b56fb2 View commit details
Showing with 20 additions and 13 deletions.
  1. +20 −13 corelib/kernel.rb
33 changes: 20 additions & 13 deletions corelib/kernel.rb
Original file line number Diff line number Diff line change
@@ -36,16 +36,19 @@ def method(name)
def methods(all = true)
%x{
var methods = [];
for(var k in self) {
if(k[0] == "$" && typeof (self)[k] === "function") {
if(all === #{false} || all === #{nil}) {
if(!Object.hasOwnProperty.call(self, k)) {
for (var key in self) {
if (key[0] == "$" && typeof(self[key]) === "function") {
if (all == false || all === nil) {
if (!$opal.hasOwnProperty.call(self, key)) {
continue;
}
}
methods.push(k.substr(1));
methods.push(key.substr(1));
}
}
return methods;
}
end
@@ -81,17 +84,17 @@ def class
end

def define_singleton_method(name, &body)
%x{
if (body === nil) {
throw new Error("no block given");
}
unless body
raise ArgumentError, "tried to create Proc object without a block"
end

%x{
var jsid = '$' + name;
body._jsid = name;
body._s = null;
body._def = body;
#{self.singleton_class}._proto[jsid] = body;
#{singleton_class}._proto[jsid] = body;
return self;
}
@@ -369,9 +372,13 @@ def lambda(&block)
end

def loop(&block)
`while (true) {`
yield
`}`
%x{
while (true) {
if (block() === $breaker) {
return $breaker.$v;
}
}
}

self
end