Package org.jruby

Examples of org.jruby.RubyArray$DefaultComparator


 
  }
 
  public RubyArray readAll() throws KettleException{
   
    RubyArray arr = data.runtime.newArray();
   
    while(true){
      IRubyObject o = read();
      if (o.isNil()) break;
      arr.append(o);
    }
   
    return arr;
   
  }
View Full Code Here


  public IRubyObject read(long upTo) throws KettleException{
   
    // request to read <0 rows
    if (upTo < 0) return data.runtime.getNil();
   
    RubyArray arr = data.runtime.newArray();
    int read = 0;
    while(read < upTo){
      IRubyObject o = read();
      if (o.isNil()) break;
      arr.append(o);
      read++;
    }
   
    // request to read from empty stream
    if (arr.size() == 0 && upTo > 0) return data.runtime.getNil();
   
    return arr;
 
  }
View Full Code Here

 
  }
 
  public RubyArray readAll() throws KettleException{
   
    RubyArray arr = data.runtime.newArray();
   
    while(true){
      IRubyObject o = read();
      if (o.isNil()) break;
      arr.append(o);
    }
   
    return arr;
   
  }
View Full Code Here

  public IRubyObject read(long upTo){
   
    // request to read <0 rows
    if (upTo < 0) return data.runtime.getNil();
   
    RubyArray arr = data.runtime.newArray();
    int read = 0;
    while(read < upTo){
      IRubyObject o = read();
      if (o.isNil()) break;
      arr.append(o);
      read++;
    }
   
    // request to read from empty stream
    if (arr.size() == 0 && upTo > 0) return data.runtime.getNil();
   
    return arr;
 
  }
View Full Code Here

 
  }
 
  public RubyArray readAll(){
   
    RubyArray arr = data.runtime.newArray();
   
    while(true){
      IRubyObject o = read();
      if (o.isNil()) break;
      arr.append(o);
    }
   
    return arr;
   
  }
View Full Code Here

   * Removes a box from Vagrant
   * @param boxName name of the box you want to remove
   */
  public void removeBox(String boxName) {
    try {
      RubyArray boxes = (RubyArray) ((RubyObject) vagrantEnvironment
          .callMethod("boxes")).getInternalVariable("@boxes");
      for (Object box : boxes) {
        String name = ((RubyObject) box).callMethod("name").toString();
        if(name.equals(boxName)) {
          ((RubyObject) box).callMethod("destroy");
View Full Code Here

   * Creates a iterator for all available boxes in Vagrant.
   * @return a iterator for all boxes.
   */
  public Iterable<String> getAllAvailableBoxes() {
    try {
      RubyArray boxes = (RubyArray) ((RubyObject) vagrantEnvironment
          .callMethod("boxes")).getInternalVariable("@boxes");
      ArrayList<String> ret = new ArrayList<>();
      for (Object box : boxes) {
        ret.add(((RubyObject) box).callMethod("name").toString());
      }
View Full Code Here

   * Creates a iterator for all configured VMs in this environment.
   * @return a iterator for all VMs in this environment.
   */
  public Iterable<VagrantVm> getAllVms() {
    try {
      RubyArray o = (RubyArray) vagrantEnvironment
          .callMethod("vms_ordered");
      ArrayList<VagrantVm> vms = new ArrayList<>();
      for (Object vm : o) {
        vms.add(new VagrantVm((RubyObject) vm));
      }
View Full Code Here

   * @param index the index
   * @return the VM at the given index
   */
  public VagrantVm getVm(int index) {
    try {
      RubyArray o = (RubyArray) vagrantEnvironment
          .callMethod("vms_ordered");
      return new VagrantVm((RubyObject) o.get(index));
    } catch (RaiseException exception) {
      throw new VagrantException(exception);
    }
  }
View Full Code Here

   * Returns the count of all VMs configured in this environment
   * @return the count of all VMs
   */
  public int getVmCount() {
    try {
      RubyArray o = (RubyArray) vagrantEnvironment
          .callMethod("vms_ordered");
      return o.size();
    } catch (RaiseException exception) {
      throw new VagrantException(exception);
    }
  }
View Full Code Here

TOP

Related Classes of org.jruby.RubyArray$DefaultComparator

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.