Package org.jruby

Examples of org.jruby.RubyEncoding


        HashEntryIterator hei = encodings.entryIterator();
        while (hei.hasNext()) {
            CaseInsensitiveBytesHash.CaseInsensitiveBytesHashEntry<Entry> e =
                ((CaseInsensitiveBytesHash.CaseInsensitiveBytesHashEntry<Entry>)hei.next());
            Entry ee = e.value;
            RubyEncoding encoding = RubyEncoding.newEncoding(runtime, e.bytes, e.p, e.end, ee.isDummy());
            encodingList[ee.getIndex()] = encoding;
            defineEncodingConstants(runtime, encoding, e.bytes, e.p, e.end);
        }
    }
View Full Code Here


        HashEntryIterator hei = aliases.entryIterator();
        while (hei.hasNext()) {
            CaseInsensitiveBytesHash.CaseInsensitiveBytesHashEntry<Entry> e =
                ((CaseInsensitiveBytesHash.CaseInsensitiveBytesHashEntry<Entry>)hei.next());
            Entry ee = e.value;
            RubyEncoding encoding = (RubyEncoding)encodingList[ee.getIndex()];
            defineEncodingConstants(runtime, encoding, e.bytes, e.p, e.end);
        }
    }
View Full Code Here

    public RaiseException newPgError(ThreadContext context, String message, ResultSet result, org.jcodings.Encoding encoding) {
      RubyClass klass = context.runtime.getModule("PG").getClass("Error");
      RubyString rubyMessage = context.runtime.newString(message);
      if (encoding != null) {
        RubyEncoding rubyEncoding = RubyEncoding.newEncoding(context.runtime, encoding);
        rubyMessage = (RubyString) rubyMessage.encode(context, rubyEncoding);
      }
      IRubyObject rubyResult = result == null ? context.nil : createResult(context, result, NULL_ARRAY, Block.NULL_BLOCK);
      IRubyObject exception = klass.newInstance(context, rubyMessage, rubyResult, Block.NULL_BLOCK);
      return new RaiseException((RubyException) exception);
View Full Code Here

    @JRubyMethod(alias = "escape_string")
    public IRubyObject escape(ThreadContext context, IRubyObject _str) {
      RubyString str = (RubyString) _str;
      String javaString = str.toString();
      byte[] bytes = postgresqlConnection.escapeString(javaString).getBytes();
      RubyEncoding encoding = (RubyEncoding) internal_encoding(context);
      return context.runtime.newString(new ByteList(bytes, encoding.getEncoding()));
    }
View Full Code Here

TOP

Related Classes of org.jruby.RubyEncoding

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.