Sha256: d5d771b41298049c536b18cc395369d1aff35c244f83d6ab15686377388f305a
Contents?: true
Size: 1.15 KB
Versions: 37
Compression:
Stored size: 1.15 KB
Contents
class V8::Access module Invocation def methodcall(code, this, args) code.methodcall this, args end module Aritize def aritize(args) arity < 0 ? args : Array.new(arity).to_enum(:each_with_index).map {|item, i| args[i]} end end module Proc include Aritize def methodcall(this, args) call *aritize([this].concat(args)) end ::Proc.send :include, self end module Method include Aritize def methodcall(this, args) context = V8::Context.current access = context.access if this.equal? self.receiver call *aritize(args) elsif this.class <= self.receiver.class access.methodcall(unbind, this, args) elsif this.equal? context.scope call *aritize(args) else fail TypeError, "cannot invoke #{self} on #{this}" end end ::Method.send :include, self end module UnboundMethod def methodcall(this, args) access = V8::Context.current.access access.methodcall bind(this), this, args end ::UnboundMethod.send :include, self end end end
Version data entries
37 entries across 37 versions & 8 rubygems