Skip to content

Commit

Permalink
Use updated Opal
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Oct 10, 2013
1 parent 4a8b560 commit 04592d6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 35 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ Visit the page in any browser and view the console:

$ open http://localhost:9292

## TODO
## Things to fix

`opal/opal-rspec/fixes.rb` contains a few bug fixes that need to be merged upstream
to opal itself.

In app/rspec we have to stub various rspec files (8 currently). This is why,
and what is needed to fix them:
Expand Down
34 changes: 0 additions & 34 deletions opal/opal-rspec/fixes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,37 +49,3 @@ class RSpec::Core::Hooks::HookCollection
`def.$__send__ = Opal.Kernel.$__send__`
`def.$class = Opal.Kernel.$class`
end

class Array
def flatten(level = undefined)
%x{
var result = [];
for (var i = 0, length = #{self}.length, item; i < length; i++) {
item = #{self}[i];
if (!item._isArray && #{`item`.respond_to?(:to_ary)}) {
item = item.$to_ary();
}
if (item._isArray) {
if (level == null) {
result = result.concat(#{`item`.flatten});
}
else if (level === 0) {
result.push(item);
}
else {
result = result.concat(#{`item`.flatten(`level - 1`)});
}
}
else {
result.push(item);
}
}
return result;
}
end
end

0 comments on commit 04592d6

Please sign in to comment.