Package org.jruby

Examples of org.jruby.RubyClass.allocate()


    @JRubyMethod(name = "new", meta = true)
    public static RubyGzipFile newInstance(IRubyObject recv, Block block) {
        RubyClass klass = (RubyClass) recv;

        RubyGzipFile result = (RubyGzipFile) klass.allocate();

        result.callInit(new IRubyObject[0], block);

        return result;
    }
View Full Code Here


    }

    @JRubyMethod(name = "inflate", required = 1, meta = true)
    public static IRubyObject s_inflate(ThreadContext context, IRubyObject recv, IRubyObject string) {
        RubyClass klass = (RubyClass) recv;
        JZlibInflate inflate = (JZlibInflate) klass.allocate();
        inflate.init(JZlib.DEF_WBITS);

        IRubyObject result;
        try {
            inflate.append(string.convertToString().getByteList());
View Full Code Here

    };

    @JRubyMethod(name = "new", rest = true, meta = true)
    public static JZlibRubyGzipReader newInstance(IRubyObject recv, IRubyObject[] args, Block block) {
        RubyClass klass = (RubyClass) recv;
        JZlibRubyGzipReader result = (JZlibRubyGzipReader) klass.allocate();
        result.callInit(args, block);
        return result;
    }

    @JRubyMethod(name = "open", required = 1, optional = 1, meta = true, compat = RUBY1_8)
View Full Code Here

    //entity should be datomic.Entity type
    private Object entity = null;

    static IRubyObject getDiametricEntity(ThreadContext context, Object value) {
        RubyClass clazz = (RubyClass)context.getRuntime().getClassFromPath("Diametric::Persistence::Entity");
        DiametricEntity diametric_entity = (DiametricEntity)clazz.allocate();
        diametric_entity.init(value);
        return diametric_entity;
    }

    public DiametricEntity(Ruby runtime, RubyClass klazz) {
View Full Code Here

    @JRubyMethod
    public IRubyObject db(ThreadContext context) {
        try {
            Object database = DiametricService.getFn("datomic.api", "entity-db").invoke(entity);
            RubyClass clazz = (RubyClass)context.getRuntime().getClassFromPath("Diametric::Persistence::Database");
            DiametricDatabase diametric_database = (DiametricDatabase)clazz.allocate();
            diametric_database.init(database);
            return diametric_database;
        } catch (Throwable t) {
            throw context.getRuntime().newRuntimeError(t.getMessage());
        }
View Full Code Here

    private static final long serialVersionUID = 2083281771243513904L;
    private java.util.UUID java_uuid = null;

    static IRubyObject getDiametricUUID(ThreadContext context, java.util.UUID value) {
        RubyClass clazz = (RubyClass)context.getRuntime().getClassFromPath("Diametric::Persistence::UUID");
        DiametricUUID diametric_uuid = (DiametricUUID)clazz.allocate();
        diametric_uuid.init((java.util.UUID)value);
        return diametric_uuid;
    }

    public DiametricUUID(Ruby runtime, RubyClass klazz) {
View Full Code Here

    }
   
    @JRubyMethod(name = "new", meta = true)
    public static IRubyObject rbNew(ThreadContext context, IRubyObject klazz) {
        RubyClass clazz = (RubyClass)context.getRuntime().getClassFromPath("Diametric::Persistence::UUID");
        DiametricUUID diametric_uuid = (DiametricUUID)clazz.allocate();
        try {
            java.util.UUID java_uuid = (UUID) DiametricService.getFn("datomic.api", "squuid").invoke();
            diametric_uuid.init(java_uuid);
            return diametric_uuid;
        } catch (Throwable t) {
View Full Code Here

        Ruby runtime = context.getRuntime();
        if (future == null) return runtime.getNil();
        try {
            Object result = ((ListenableFuture)future).get();
            RubyClass clazz = (RubyClass)runtime.getClassFromPath("Diametric::Persistence::Object");
            DiametricObject diametric_object = (DiametricObject)clazz.allocate();
            diametric_object.update(result);
            return diametric_object;
        } catch (Throwable t) {
            throw runtime.newRuntimeError(t.getMessage());
        }
View Full Code Here

    private Integer count = null// unable to count the vector size that exceeds Integer
    private DiametricCommon common = null;

    static IRubyObject getDiametricSet(ThreadContext context, Set value) {
        RubyClass clazz = (RubyClass)context.getRuntime().getClassFromPath("Diametric::Persistence::Set");
        DiametricSet diametric_set = (DiametricSet)clazz.allocate();
        diametric_set.init(value);
        return diametric_set;
    }

    public DiametricSet(Ruby runtime, RubyClass klazz) {
View Full Code Here

    @JRubyMethod(meta=true)
    public static IRubyObject wrap(ThreadContext context, IRubyObject klazz, IRubyObject arg) {
        try {
            Set<Object> s = (Set<Object>)arg.toJava(Set.class);
            RubyClass clazz = (RubyClass) context.getRuntime().getClassFromPath("Diametric::Persistence::Set");
            DiametricSet ruby_set = (DiametricSet)clazz.allocate();
            ruby_set.init(s);
            return ruby_set;
        } catch (Throwable t) {
            throw context.getRuntime().newRuntimeError(t.getMessage());
        }
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.