Examples of defineMethod()


Examples of com.stuffwithstuff.magpie.Magpie.defineMethod()

 
  public static void execute(String path) throws IOException {
    String script = MagpieAppHost.readFile(path);
    Magpie magpie = new Magpie(new MagpieAppHost());
   
    magpie.defineMethod("printString(s is String)",
        "Prints the given string to stdout.", new Method() {
      public Object call(Object left, Object right) {
        System.out.print(right);
        return null;
      }
View Full Code Here

Examples of org.jruby.RubyClass.defineMethod()

        klass.fastSetInternalVariable("__size__", runtime.newFixnum(members.length));
        klass.setAllocator(alloc_hpricot_struct);

        for(int i = 0; i < members.length; i++) {
            String id = members[i].toString();
            klass.defineMethod(id, ref_func[i]);
            klass.defineMethod(id + "=", set_func[i]);
        }

        return klass;
    }
View Full Code Here

Examples of org.jruby.RubyClass.defineMethod()

        klass.setAllocator(alloc_hpricot_struct);

        for(int i = 0; i < members.length; i++) {
            String id = members[i].toString();
            klass.defineMethod(id, ref_func[i]);
            klass.defineMethod(id + "=", set_func[i]);
        }

        return klass;
    }
View Full Code Here

Examples of org.jruby.RubyClass.defineMethod()

    public boolean basicLoad(final Ruby runtime) throws IOException {
        RubyClass cJdbcConn = ((RubyModule)(runtime.getModule("ActiveRecord").getConstant("ConnectionAdapters"))).
            defineClassUnder("JdbcConnection",runtime.getObject(),runtime.getObject().getAllocator());

        CallbackFactory cf = runtime.callbackFactory(JdbcAdapterInternalService.class);
        cJdbcConn.defineMethod("unmarshal_result",cf.getSingletonMethod("unmarshal_result", IRubyObject.class));
        cJdbcConn.defineFastMethod("set_connection",cf.getFastSingletonMethod("set_connection", IRubyObject.class));
        cJdbcConn.defineFastMethod("execute_update",cf.getFastSingletonMethod("execute_update", IRubyObject.class));
        cJdbcConn.defineFastMethod("execute_query",cf.getFastOptSingletonMethod("execute_query"));
        cJdbcConn.defineFastMethod("execute_insert",cf.getFastSingletonMethod("execute_insert", IRubyObject.class));
        cJdbcConn.defineFastMethod("execute_id_insert",cf.getFastSingletonMethod("execute_id_insert", IRubyObject.class, IRubyObject.class));
View Full Code Here

Examples of org.jruby.RubyModule.defineMethod()

public class FastXsService implements BasicLibraryService {

    public boolean basicLoad(final Ruby runtime) throws IOException {
        RubyModule string = runtime.getModule("String");
        CallbackFactory fact = runtime.callbackFactory(FastXsService.class);
        string.defineMethod("fast_xs",fact.getFastSingletonMethod("fast_xs"));
        return true;
    }

    public static IRubyObject fast_xs(IRubyObject recv) {
        String string = recv.convertToString().getUnicodeValue();
View Full Code Here

Examples of org.jruby.RubyModule.defineMethod()

public class FastXsService implements BasicLibraryService {

    public boolean basicLoad(final Ruby runtime) throws IOException {
        RubyModule string = runtime.getModule("String");
        CallbackFactory fact = runtime.callbackFactory(FastXsService.class);
        string.defineMethod("fast_xs",fact.getFastSingletonMethod("fast_xs"));
        return true;
    }

    public static IRubyObject fast_xs(IRubyObject recv) {
        String string = recv.convertToString().getUnicodeValue();
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.