Package org.jruby

Examples of org.jruby.RubyModule.defineAnnotatedMethods()


        } else {
            configModule = runtime.defineModule("Config");
            runtime.getObject().defineConstant("RbConfig", configModule);
        }
       
        configModule.defineAnnotatedMethods(RbConfigLibrary.class);
       
        RubyHash configHash = RubyHash.newHash(runtime);
        configModule.defineConstant("CONFIG", configHash);

        String[] versionParts;
View Full Code Here


                }
            }
        });

        RubyModule mDigest = runtime.defineModule("Digest");
        mDigest.defineAnnotatedMethods(RubyDigest.class);
        RubyModule mDigestInstance = mDigest.defineModuleUnder("Instance");
        mDigestInstance.defineAnnotatedMethods(DigestInstance.class);
        RubyClass cDigestClass = mDigest.defineClassUnder("Class", runtime.getObject(), DigestClass.DIGEST_CLASS_ALLOCATOR);
        cDigestClass.defineAnnotatedMethods(DigestClass.class);
        cDigestClass.includeModule(mDigestInstance);
View Full Code Here

        });

        RubyModule mDigest = runtime.defineModule("Digest");
        mDigest.defineAnnotatedMethods(RubyDigest.class);
        RubyModule mDigestInstance = mDigest.defineModuleUnder("Instance");
        mDigestInstance.defineAnnotatedMethods(DigestInstance.class);
        RubyClass cDigestClass = mDigest.defineClassUnder("Class", runtime.getObject(), DigestClass.DIGEST_CLASS_ALLOCATOR);
        cDigestClass.defineAnnotatedMethods(DigestClass.class);
        cDigestClass.includeModule(mDigestInstance);
        RubyClass cDigestBase = mDigest.defineClassUnder("Base", cDigestClass, DigestBase.DIGEST_BASE_ALLOCATOR);
        cDigestBase.defineAnnotatedMethods(DigestBase.class);
View Full Code Here

public class BinUtilsService implements BasicLibraryService {
    public boolean basicLoad(Ruby ruby) {
  RubyModule bin_utils = ruby.defineModule("BinUtils");
  RubyModule java_utils = bin_utils.defineModuleUnder("Native");
  java_utils.defineAnnotatedMethods(JavaUtils.class);
  java_utils.extend_object(java_utils);
  return true;
    }
}
View Full Code Here

*/
public class JRubyUtilLibrary implements Library {

    public void load(Ruby runtime, boolean wrap) throws IOException {
        RubyModule mJRubyUtil = runtime.getOrCreateModule("JRuby").defineModuleUnder("Util");
        mJRubyUtil.defineAnnotatedMethods(JRubyUtilLibrary.class);

        // core class utils
        runtime.getString().defineAnnotatedMethods(StringUtils.class);
    }

View Full Code Here

        RubyModule rand = ossl.defineModuleUnder("Random");

        RubyClass osslError = (RubyClass)ossl.getConstant("OpenSSLError");
        rand.defineClassUnder("RandomError",osslError,osslError.getAllocator());

        rand.defineAnnotatedMethods(Random.class);

        RandomHolder holder = new RandomHolder();
        holder.randomizers = new java.util.Random[]{new java.util.Random(), new SecureRandom()};
        rand.dataWrapStruct(holder);
    }
View Full Code Here

        module.defineConstant("LIBPREFIX", runtime.newString(LIBPREFIX));
        module.defineConstant("LIBSUFFIX", runtime.newString(LIBSUFFIX));
        module.defineConstant("BYTE_ORDER", runtime.newFixnum(BYTE_ORDER));
        module.defineConstant("BIG_ENDIAN", runtime.newFixnum(BIG_ENDIAN));
        module.defineConstant("LITTLE_ENDIAN", runtime.newFixnum(LITTLE_ENDIAN));
        module.defineAnnotatedMethods(Platform.class);
    }
    @JRubyMethod(name = "windows?", module=true)
    public static IRubyObject windows_p(ThreadContext context, IRubyObject recv) {
        return context.runtime.newBoolean(OS == OS.WINDOWS);
    }
View Full Code Here

public abstract class PKey extends RubyObject {
    private static final long serialVersionUID = 6114668087816965720L;

    public static void createPKey(Ruby runtime, RubyModule ossl) {
        RubyModule mPKey = ossl.defineModuleUnder("PKey");
        mPKey.defineAnnotatedMethods(PKeyModule.class);
        // PKey is abstract
        RubyClass cPKey = mPKey.defineClassUnder("PKey",runtime.getObject(),ObjectAllocator.NOT_ALLOCATABLE_ALLOCATOR);
        RubyClass openSSLError = ossl.getClass("OpenSSLError");
        mPKey.defineClassUnder("PKeyError",openSSLError,openSSLError.getAllocator());
View Full Code Here

    public static RubyModule createEtcModule(Ruby runtime) {
        RubyModule etcModule = runtime.defineModule("Etc");

        runtime.setEtc(etcModule);
       
        etcModule.defineAnnotatedMethods(RubyEtc.class);
       
        definePasswdStruct(runtime);
        defineGroupStruct(runtime);
       
        return etcModule;
View Full Code Here

        RubyModule mReadline = runtime.defineModule("Readline");

        mReadline.dataWrapStruct(holder);

        mReadline.defineAnnotatedMethods(Readline.class);
        IRubyObject hist = runtime.getObject().callMethod(runtime.getCurrentContext(), "new");
        mReadline.setConstant("HISTORY", hist);
        hist.getSingletonClass().includeModule(runtime.getEnumerable());
        hist.getSingletonClass().defineAnnotatedMethods(HistoryMethods.class);
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.