Sha256: 5b61919be3970b4ef003dd44e569baa8303b1a5dca48a9e88aa81d7fa1b2165b
Contents?: true
Size: 1.44 KB
Versions: 1
Compression:
Stored size: 1.44 KB
Contents
class BasicObject def initialize(*) end def ==(other) `self === other` end def eql?(other) self == other end def __id__ `self.$$id || (self.$$id = Opal.uid())` end def __send__(symbol, *args, &block) %x{ var func = self['$' + symbol] if (func) { if (block !== nil) { func.$$p = block; } return func.apply(self, args); } if (block !== nil) { self.$method_missing.$$p = block; } return self.$method_missing.apply(self, [symbol].concat(args)); } end def ! false end def !=(other) !(self == other) end alias equal? == def instance_eval(&block) Kernel.raise ArgumentError, "no block given" unless block %x{ var old = block.$$s, result; block.$$s = null; result = block.call(self, self); block.$$s = old; return result; } end def instance_exec(*args, &block) Kernel.raise ArgumentError, "no block given" unless block %x{ var block_self = block.$$s, result; block.$$s = null; result = block.apply(self, args); block.$$s = block_self; return result; } end def method_missing(symbol, *args, &block) Kernel.raise NoMethodError, `self.$inspect && !self.$inspect.$$stub` ? "undefined method `#{symbol}' for #{inspect}:#{`self.$$class`}" : "undefined method `#{symbol}' for #{`self.$$class`}" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
opal-wedge-0.9.0.dev | opal/corelib/basic_object.rb |