@RubyLevelMethod(name = "p", module = true)
 public static RubyValue p(RubyValue receiver, RubyValue arg) {
   RubyValue str = RubyAPI.callNoArgMethod(arg, null, RubyID.inspectID);
   RubyString value = str.toRubyString();
   value.appendString("\n");
   System.out.print(value.toString());
   return RubyConstant.QNIL;
 }
Exemple #2
0
  public int appendString2(RubyValue v) {
    RubyString str = null;
    if (v instanceof RubyString) {
      str = (RubyString) v;
    } else {
      RubyValue r = RubyAPI.callPublicNoArgMethod(v, null, RubyID.toSID);
      str = (RubyString) r;
    }

    appendString(str);

    return str.length();
  }