예제 #1
0
        public Object unmarshalFrom(Ruby runtime, RubyClass type, UnmarshalStream unmarshalStream)
            throws IOException {
          RubySystemCallError exc = (RubySystemCallError) type.allocate();

          unmarshalStream.registerLinkTarget(exc);
          unmarshalStream.defaultVariablesUnmarshal(exc);

          exc.message = (IRubyObject) exc.removeInternalVariable("mesg");
          exc.errno = (IRubyObject) exc.removeInternalVariable("errno");
          exc.set_backtrace((IRubyObject) exc.removeInternalVariable("bt"));

          return exc;
        }
예제 #2
0
        public Object unmarshalFrom(Ruby runtime, RubyClass type, UnmarshalStream unmarshalStream)
            throws IOException {
          RubyRange range = (RubyRange) type.allocate();

          unmarshalStream.registerLinkTarget(range);

          unmarshalStream.defaultVariablesUnmarshal(range);

          range.begin = (IRubyObject) range.removeInternalVariable("begin");
          range.end = (IRubyObject) range.removeInternalVariable("end");
          range.isExclusive = ((IRubyObject) range.removeInternalVariable("excl")).isTrue();

          return range;
        }
예제 #3
0
파일: RubyFloat.java 프로젝트: komax/jruby
 public static RubyFloat unmarshalFrom(UnmarshalStream input) throws java.io.IOException {
   ByteList value = input.unmarshalString();
   RubyFloat result;
   if (value.equals(NAN_BYTELIST)) {
     result = RubyFloat.newFloat(input.getRuntime(), RubyFloat.NAN);
   } else if (value.equals(NEGATIVE_INFINITY_BYTELIST)) {
     result = RubyFloat.newFloat(input.getRuntime(), Double.NEGATIVE_INFINITY);
   } else if (value.equals(INFINITY_BYTELIST)) {
     result = RubyFloat.newFloat(input.getRuntime(), Double.POSITIVE_INFINITY);
   } else {
     result = RubyFloat.newFloat(input.getRuntime(), ConvertDouble.byteListToDouble(value, false));
   }
   input.registerLinkTarget(result);
   return result;
 }