Examples of defineClassUnder()


Examples of org.jruby.RubyClass.defineClassUnder()

public class RubyHttpParserService implements BasicLibraryService {
  public boolean basicLoad(final Ruby runtime) throws IOException {
    RubyModule mHTTP = runtime.defineModule("HTTP");
    RubyClass cParser = mHTTP.defineClassUnder("Parser", runtime.getObject(), RubyHttpParser.ALLOCATOR);
    cParser.defineAnnotatedMethods(RubyHttpParser.class);
    cParser.defineClassUnder("Error", runtime.getClass("IOError"),runtime.getClass("IOError").getAllocator());
    return true;
  }
}
View Full Code Here

Examples of org.jruby.RubyClass.defineClassUnder()

    public void load(Ruby runtime, boolean wrap) throws IOException {
        RubyKernel.require(runtime.getKernel(), runtime.newString("delegate"), Block.NULL_BLOCK);
        RubyClass delegatorClass = (RubyClass) runtime.getClassFromPath("Delegator");
        RubyClass weakrefClass = runtime.defineClass("WeakRef", delegatorClass, WeakRef.WEAKREF_ALLOCATOR);
        weakrefClass.defineAnnotatedMethods(WeakRef.class);
        weakrefClass.defineClassUnder("RefError", runtime.getStandardError(), runtime.getStandardError().getAllocator());
    }
}
View Full Code Here

Examples of org.jruby.RubyModule.defineClassUnder()

    /** The Memory I/O object */
    protected final MemoryIO io;
   
    public static RubyClass createAbstractMemoryClass(Ruby runtime) {
        RubyModule module = FFIProvider.getModule(runtime);
        RubyClass result = module.defineClassUnder(ABSTRACT_MEMORY_RUBY_CLASS,
                runtime.getObject(),
                ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
       
        result.defineAnnotatedMethods(AbstractMemory.class);
        result.defineAnnotatedConstants(AbstractMemory.class);
View Full Code Here

Examples of org.jruby.RubyModule.defineClassUnder()

     */
    protected final Arity arity;
   
    public static RubyClass createInvokerClass(Ruby runtime) {
        RubyModule module = FFIProvider.getModule(runtime);
        RubyClass result = module.defineClassUnder(CLASS_NAME,
                runtime.getObject(),
                ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
        result.defineAnnotatedMethods(Invoker.class);
        result.defineAnnotatedConstants(Invoker.class);

View Full Code Here

Examples of org.jruby.RubyModule.defineClassUnder()

    private static final Map<AbstractMemoryPointer, Object> pointerSet
            = new ConcurrentHashMap();
   
    public static RubyClass createMemoryPointerClass(Ruby runtime) {
        RubyModule module = FFIProvider.getModule(runtime);
        RubyClass result = module.defineClassUnder(className,
                module.getClass(AbstractMemory.ABSTRACT_MEMORY_RUBY_CLASS),
                ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
       
        result.defineAnnotatedMethods(AbstractMemoryPointer.class);
        result.defineAnnotatedConstants(AbstractMemoryPointer.class);
View Full Code Here

Examples of org.jruby.RubyModule.defineClassUnder()

    protected final NativeType[] parameterTypes;
    protected final NativeType returnType;
   
    public static RubyClass createCallbackClass(Ruby runtime) {
        RubyModule module = FFIProvider.getModule(runtime);
        RubyClass result = module.defineClassUnder(CLASS_NAME,
                runtime.getObject(),
                ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
        result.defineAnnotatedMethods(Callback.class);
        result.defineAnnotatedConstants(Callback.class);
View Full Code Here

Examples of org.jruby.RubyModule.defineClassUnder()

abstract public class AbstractBuffer extends AbstractMemory {
    public final static String ABSTRACT_BUFFER_RUBY_CLASS = "AbstractBuffer";

    public static RubyClass createBufferClass(Ruby runtime) {
        RubyModule module = FFIProvider.getModule(runtime);
        RubyClass result = module.defineClassUnder(ABSTRACT_BUFFER_RUBY_CLASS,
                module.getClass(AbstractMemory.ABSTRACT_MEMORY_RUBY_CLASS),
                ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
       
        result.defineAnnotatedMethods(AbstractBuffer.class);
        result.defineAnnotatedConstants(AbstractBuffer.class);
View Full Code Here

Examples of org.jruby.RubyModule.defineClassUnder()

public class JNAMemoryPointer extends AbstractMemoryPointer implements JNAMemory {
    public static final String MEMORY_POINTER_NAME = "MemoryPointer";
   
    public static RubyClass createMemoryPointerClass(Ruby runtime) {
        RubyModule module = FFIProvider.getModule(runtime);
        RubyClass result = module.defineClassUnder(MEMORY_POINTER_NAME,
                module.getClass(AbstractMemoryPointer.className),
                ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
        result.defineAnnotatedMethods(JNAMemoryPointer.class);
        result.defineAnnotatedConstants(JNAMemoryPointer.class);
View Full Code Here

Examples of org.jruby.RubyModule.defineClassUnder()

    public static final String MODULE_NAME = "JRuby::FFI";
    public static final String CLASS_NAME = "Provider";
   
    public static RubyClass createProviderClass(Ruby runtime) {
        RubyModule module = FFIProvider.getModule(runtime);
        RubyClass result = module.defineClassUnder(CLASS_NAME,
                runtime.getObject(),
                ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
        result.defineAnnotatedMethods(FFIProvider.class);
        result.defineAnnotatedConstants(FFIProvider.class);
View Full Code Here

Examples of org.jruby.RubyModule.defineClassUnder()

  public boolean basicLoad(Ruby runtime) throws IOException {
    this.runtime = runtime;
    RubyModule websocket = runtime.defineModule("WebSocket");

    RubyClass webSocketMask = websocket.defineClassUnder("Mask", runtime.getObject(), new ObjectAllocator() {
      public IRubyObject allocate(Ruby runtime, RubyClass rubyClass) {
        return new WebsocketMask(runtime, rubyClass);
      }
    });
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.