Package org.jruby

Examples of org.jruby.RubyObject


      RubySymbol className = (RubySymbol)unmarshalObject();
     
      RubyClass type = (RubyClass)runtime.getClassFromPath(className.asJavaString());
     
        // All "C" marshalled objects descend from core classes, which are all RubyObject
      RubyObject result = (RubyObject)unmarshalObject();
     
      result.setMetaClass(type);
     
      return result;
    }
View Full Code Here


  Ruby runtime = null;
  RubyArray rv = null;

  void pass_through(String str) {
    RubyObject last = ((RubyObject)rv.last());
    if ( rv.size() > 0 &&  last != null && (last instanceof RubyString) ){
      // XXX concat changes for ruby 1.9
      ((RubyString) last).concat(RubyString.newString(runtime, str));
    } else {
      rv.append(RubyString.newString(runtime, str));
View Full Code Here

    newEnv.put("VAGRANT_LOG", "DEBUG");
    scriptingContainer.setEnvironment(newEnv);
  }
 
  public VagrantEnvironment createEnvironment() {
    RubyObject vagrantEnv = (RubyObject) scriptingContainer.runScriptlet("require 'rubygems'\n"
        + "require 'vagrant'\n"
        + "\n" + "return Vagrant::Environment.new");
    return new VagrantEnvironment(vagrantEnv);
  }
View Full Code Here

        + "\n" + "return Vagrant::Environment.new");
    return new VagrantEnvironment(vagrantEnv);
  }
 
  public VagrantEnvironment createEnvironment(File path) {
    RubyObject vagrantEnv = (RubyObject) scriptingContainer.runScriptlet("require 'rubygems'\n"
        + "require 'vagrant'\n"
        + "\n" + "return Vagrant::Environment.new(:cwd => '" + path.getAbsolutePath() + "')");
    return new VagrantEnvironment(vagrantEnv);
  }
View Full Code Here

   * If this environment is a single VM environment (only contains one VM) this methode will return the VM object.
   * @return the object for the VM in this environment.
   */
  public VagrantVm getPrimaryVm() {
    try {
      RubyObject rubyVm = (RubyObject) vagrantEnvironment.callMethod("primary_vm");
      if(rubyVm == null || rubyVm instanceof RubyNil) {
        throw new VagrantException("No primary vm found. Maybe there is no vm defined in your configuration or you are working with a multi vm environment.");
      }
      return new VagrantVm(rubyVm);
    } catch (RaiseException exception) {
View Full Code Here

        if (vars.isLazy()) return;
        // user defined constants of top level go to a super class
        updateConstantsOfSuperClass(receiver, vars);
        // Constants might have the same names but different receivers.
        updateConstants(receiver, vars);
        RubyObject topSelf = (RubyObject)receiver.getRuntime().getTopSelf();
        updateConstants(topSelf, vars);
    }
View Full Code Here

    public static void retrieve(RubyObject receiver, BiVariableMap vars) {
        if (vars.isLazy()) return;
        // trying to get variables from receiver;
        updateClassVar(receiver, vars);
        // trying to get variables from topself.
        RubyObject topSelf = (RubyObject) receiver.getRuntime().getTopSelf();
        updateClassVar(topSelf, vars);
    }
View Full Code Here

        super(name);
    }

    public void setUp() {
        runtime = Ruby.newInstance();
        rubyObject = new RubyObject(runtime, runtime.getObject());
    }
View Full Code Here

    // player?
    if (RubyHelper.toInt(e.getParameters().get(0)) == -1) {
      s = "Player";
      // has a map?
    } else {
      RubyObject map = e.getYecl().getMap();
      if (map != null) {
        // get all events
        RubyHash ra = (RubyHash) map.getInstanceVariable("@events");

        s = new SystemGObject((RubyObject) ra.get(e.getParameters().get(0))).getName();
      }
    }
View Full Code Here

        RubySymbol className = (RubySymbol)unmarshalObject(false);

        RubyClass type = (RubyClass)runtime.getClassFromPath(className.asJavaString());

        // All "C" marshalled objects descend from core classes, which are all RubyObject
        RubyObject result = (RubyObject)unmarshalObject();

        result.setMetaClass(type);

        return result;
    }
View Full Code Here

TOP

Related Classes of org.jruby.RubyObject

Copyright © 2018 www.massapicom. 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.