private static Encoding extractEncodingFromObject(IRubyObject obj) { if (obj instanceof RubyEncoding) return ((RubyEncoding) obj).getEncoding(); if (obj instanceof EncodingCapable) return ((EncodingCapable) obj).getEncoding(); return null; }
private static Encoding extractEncodingFromObject(IRubyObject obj) { if (obj instanceof RubyEncoding) return ((RubyEncoding) obj).getEncoding(); if (obj instanceof EncodingCapable) return ((EncodingCapable) obj).getEncoding(); return null; }
public static Encoding encGet(ThreadContext context, IRubyObject obj) { if (obj instanceof EncodingCapable) { return ((EncodingCapable)obj).getEncoding(); } return context.runtime.getDefaultInternalEncoding(); }
public static Encoding encGet(ThreadContext context, IRubyObject obj) { if (obj instanceof EncodingCapable) { return ((EncodingCapable)obj).getEncoding(); } return context.runtime.getDefaultInternalEncoding(); }
public static Encoding encGet(ThreadContext context, IRubyObject obj) { if (obj instanceof EncodingCapable) { return ((EncodingCapable)obj).getEncoding(); } return context.runtime.getDefaultInternalEncoding(); }
public static Encoding encGet(ThreadContext context, IRubyObject obj) { if (obj instanceof EncodingCapable) { return ((EncodingCapable)obj).getEncoding(); } return context.runtime.getDefaultInternalEncoding(); }
private static Encoding extractEncodingFromObject(IRubyObject obj) { if (obj instanceof RubyEncoding) return ((RubyEncoding) obj).getEncoding(); if (obj instanceof RubySymbol) return ((RubySymbol) obj).asString().getEncoding(); if (obj instanceof EncodingCapable) return ((EncodingCapable) obj).getEncoding(); return null; }
private static Encoding extractEncodingFromObject(IRubyObject obj) { if (obj instanceof RubyEncoding) return ((RubyEncoding) obj).getEncoding(); if (obj instanceof RubySymbol) return ((RubySymbol) obj).asString().getEncoding(); if (obj instanceof EncodingCapable) return ((EncodingCapable) obj).getEncoding(); return null; }
final Encoding checkEncoding(EncodingCapable other) { Encoding enc = isCompatibleWith(other); if (enc == null) throw getRuntime().newEncodingCompatibilityError("incompatible character encodings: " + value.getEncoding() + " and " + other.getEncoding()); return enc; }
final Encoding checkEncoding(EncodingCapable other) { Encoding enc = isCompatibleWith(other); if (enc == null) throw getRuntime().newEncodingCompatibilityError("incompatible character encodings: " + value.getEncoding() + " and " + other.getEncoding()); return enc; }
final Encoding checkEncoding(EncodingCapable other) { Encoding enc = isCompatibleWith(other); if (enc == null) throw getRuntime().newEncodingCompatibilityError("incompatible character encodings: " + value.getEncoding() + " and " + other.getEncoding()); return enc; }
final Encoding checkEncoding(EncodingCapable other) { Encoding enc = isCompatibleWith(other); if (enc == null) throw getRuntime().newEncodingCompatibilityError("incompatible character encodings: " + value.getEncoding() + " and " + other.getEncoding()); return enc; }
public static IRubyObject encAssociateIndex(IRubyObject obj, Encoding encidx) { ((RubyBasicObject)obj).checkFrozen(); if (((EncodingCapable)obj).getEncoding() == encidx) { return obj; } if (!((RubyString)obj).isCodeRangeAsciiOnly() || encAsciicompat(encidx)) { ((RubyString)obj).clearCodeRange(); } ((EncodingCapable)obj).setEncoding(encidx); return obj; }
public static IRubyObject encAssociateIndex(IRubyObject obj, Encoding encidx) { ((RubyBasicObject)obj).checkFrozen(); if (((EncodingCapable)obj).getEncoding() == encidx) { return obj; } if (!((RubyString)obj).isCodeRangeAsciiOnly() || encAsciicompat(encidx)) { ((RubyString)obj).clearCodeRange(); } ((EncodingCapable)obj).setEncoding(encidx); return obj; }
public static IRubyObject encAssociateIndex(IRubyObject obj, Encoding encidx) { ((RubyBasicObject)obj).checkFrozen(); if (encidx == null) encidx = ASCIIEncoding.INSTANCE; if (((EncodingCapable)obj).getEncoding() == encidx) { return obj; } if (obj instanceof RubyString && ! CodeRangeSupport.isCodeRangeAsciiOnly((RubyString) obj) || encAsciicompat(encidx)) { ((RubyString)obj).clearCodeRange(); } ((EncodingCapable)obj).setEncoding(encidx); return obj; }
public static IRubyObject encAssociateIndex(IRubyObject obj, Encoding encidx) { ((RubyBasicObject)obj).checkFrozen(); if (encidx == null) encidx = ASCIIEncoding.INSTANCE; if (((EncodingCapable)obj).getEncoding() == encidx) { return obj; } if (obj instanceof RubyString && ! CodeRangeSupport.isCodeRangeAsciiOnly((RubyString) obj) || encAsciicompat(encidx)) { ((RubyString)obj).clearCodeRange(); } ((EncodingCapable)obj).setEncoding(encidx); return obj; }
final Encoding isCompatibleWith(EncodingCapable other) { if (other instanceof RubyString) return checkEncoding((RubyString)other); Encoding enc1 = value.getEncoding(); Encoding enc2 = other.getEncoding(); if (enc1 == enc2) return enc1; if (value.getRealSize() == 0) return enc2; if (!enc1.isAsciiCompatible() || !enc2.isAsciiCompatible()) return null; if (enc2 instanceof USASCIIEncoding) return enc1; if (scanForCodeRange() == CR_7BIT) return enc2; return null; }
final Encoding isCompatibleWith(EncodingCapable other) { if (other instanceof RubyString) return checkEncoding((RubyString)other); Encoding enc1 = value.getEncoding(); Encoding enc2 = other.getEncoding(); if (enc1 == enc2) return enc1; if (value.getRealSize() == 0) return enc2; if (!enc1.isAsciiCompatible() || !enc2.isAsciiCompatible()) return null; if (enc2 instanceof USASCIIEncoding) return enc1; if (scanForCodeRange() == CR_7BIT) return enc2; return null; }
final Encoding isCompatibleWith(EncodingCapable other) { if (other instanceof RubyString) return checkEncoding((RubyString)other); Encoding enc1 = value.getEncoding(); Encoding enc2 = other.getEncoding(); if (enc1 == enc2) return enc1; if (value.getRealSize() == 0) return enc2; if (!enc1.isAsciiCompatible() || !enc2.isAsciiCompatible()) return null; if (enc2 instanceof USASCIIEncoding) return enc1; if (scanForCodeRange() == CR_7BIT) return enc2; return null; }
final Encoding isCompatibleWith(EncodingCapable other) { if (other instanceof RubyString) return checkEncoding((RubyString)other); Encoding enc1 = value.getEncoding(); Encoding enc2 = other.getEncoding(); if (enc1 == enc2) return enc1; if (value.getRealSize() == 0) return enc2; if (!enc1.isAsciiCompatible() || !enc2.isAsciiCompatible()) return null; if (enc2 instanceof USASCIIEncoding) return enc1; if (scanForCodeRange() == CR_7BIT) return enc2; return null; }