Skip to content

Commit

Permalink
Implement BasicObject#__id__
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Nov 9, 2013
1 parent 1da9826 commit 0541825
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 4 additions & 0 deletions opal/core/basic_object.rb
Expand Up @@ -6,6 +6,10 @@ def ==(other)
`self === other`
end

def __id__
`self._id || (self._id = Opal.uid())`
end

def __send__(symbol, *args, &block)
%x{
var func = self['$' + symbol]
Expand Down
4 changes: 1 addition & 3 deletions opal/core/kernel.rb
Expand Up @@ -384,9 +384,7 @@ def nil?
false
end

def object_id
`self._id || (self._id = Opal.uid())`
end
alias object_id __id__

def printf(*args)
if args.length > 0
Expand Down

0 comments on commit 0541825

Please sign in to comment.