Skip to content

Commit

Permalink
There is no 1.8.
Browse files Browse the repository at this point in the history
  • Loading branch information
headius committed Feb 14, 2016
1 parent 6ed2276 commit ecae248
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions core/src/main/java/org/jruby/ext/nkf/RubyNKF.java
Expand Up @@ -100,26 +100,17 @@ public String getCharset() {

public static void createNKF(Ruby runtime) {
final RubyModule NKF = runtime.defineModule("NKF");
final String version = "2.1.2";
final String relDate = "2011-09-08";

if (runtime.is1_8()) {
final String version = "2.0.8";
final String relDate = "2008-11-08";
NKF.defineConstant("NKF_VERSION", runtime.newString(version));
NKF.defineConstant("NKF_RELEASE_DATE", runtime.newString(relDate));
NKF.defineConstant("VERSION", runtime.newString(version + ' ' + '(' + "JRuby" + '_' + relDate + ')'));
}
else {
final String version = "2.1.2";
final String relDate = "2011-09-08";
NKF.defineConstant("NKF_VERSION", runtime.newString(version));
NKF.defineConstant("NKF_RELEASE_DATE", runtime.newString(relDate));
NKF.defineConstant("VERSION", runtime.newString(version + ' ' + '(' + "JRuby" + '_' + relDate + ')'));
}
NKF.defineConstant("NKF_VERSION", runtime.newString(version));
NKF.defineConstant("NKF_RELEASE_DATE", runtime.newString(relDate));
NKF.defineConstant("VERSION", runtime.newString(version + ' ' + '(' + "JRuby" + '_' + relDate + ')'));

for ( NKFCharset charset : NKFCharset.values() ) {
NKFCharsetMap.put(charset.value, charset.name());

if ( ! runtime.is1_8() && charset.value > 12 ) continue;
if (charset.value > 12 ) continue;
NKF.defineConstant(charset.name(), charsetMappedValue(runtime, charset));
}

Expand Down Expand Up @@ -168,8 +159,6 @@ public static IRubyObject guess(ThreadContext context, IRubyObject recv, IRubyOb
}

private static IRubyObject charsetMappedValue(final Ruby runtime, final NKFCharset charset) {
if (runtime.is1_8()) return runtime.newFixnum(charset.value);

final Encoding encoding;
switch (charset) {
case AUTO: case NOCONV: case UNKNOWN: return runtime.getNil();
Expand Down

0 comments on commit ecae248

Please sign in to comment.