Skip to content

Commit

Permalink
Expose classes, modules and methods to js
Browse files Browse the repository at this point in the history
  • Loading branch information
elia committed Sep 20, 2013
1 parent 619d46b commit 841006c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions corelib/module.rb
Expand Up @@ -47,6 +47,15 @@ def alias_native(mid, jsid)
`#{self}._proto['$' + mid] = #{self}._proto[jsid]`
end

def native_alias(jsid, mid)

This comment has been minimized.

Copy link
@DouweM

DouweM Sep 20, 2013

Contributor

Why isn't there a bang? native_alias! would be in line with native_module!.

`#{self}._proto[jsid] = #{self}._proto['$' + mid]`
end

def native_module!

This comment has been minimized.

Copy link
@DouweM

DouweM Sep 20, 2013

Contributor

Shouldn't this be def self.native_module!?

This comment has been minimized.

Copy link
@elia

elia Sep 20, 2013

Author Member

No, instances of this class are modules and classes (but I admit that I added self. at first 😄 )

This comment has been minimized.

Copy link
@DouweM

DouweM Sep 20, 2013

Contributor

Oh, right. Crazy Ruby :P

`Opal.global[#{self.name}] = #{self}`
end
alias native_class! native_module!

def ancestors
%x{
var parent = #{self},
Expand Down

0 comments on commit 841006c

Please sign in to comment.