Sha256: 9966cc0b34d21eb9b7db0bf2b6cacdb49559db4e1628fba33bad55907f168cdb

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

class BasicObject
  def initialize(*)
  end

  def ==(other)
    `this === other`
  end

  def __send__(symbol, *args, &block)
    %x{
      var meth = this[mid_to_jsid(symbol)];

      if (meth) {
        args.unshift(null);

        return meth.apply(this, args);
      }
      else {
        throw new Error("method missing yielder for " + symbol + " in __send__");
      }
    }
  end

  alias send __send__
  
  alias eql? ==
  alias equal? ==

  def instance_eval(string = nil, &block)
    %x{
      if (block === nil) {
        raise(RubyArgError, 'block not supplied');
      }

      return block.call(this, null, this);
    }
  end

  def instance_exec(*args, &block)
    %x{
      if (block === nil) {
        raise(RubyArgError, 'block not supplied');
      }

      args.unshift(null);

      return block.apply(this, args);
    }
  end

  def method_missing(symbol, *args)
    `raise(RubyNoMethodError, 'undefined method \`' + symbol + '\` for ' + #{inspect})`
  end

  def singleton_method_added(symbol)
    nil
  end

  def singleton_method_removed(symbol)
    nil
  end

  def singleton_method_undefined(symbol)
    nil
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
opal-0.3.15 runtime/corelib/basic_object.rb