File tree 1 file changed +26
-1
lines changed
core/src/main/java/org/jruby/truffle/nodes/core
1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -1249,7 +1249,6 @@ public RubyString capitalize(RubyString string) {
1249
1249
1250
1250
}
1251
1251
1252
-
1253
1252
@ CoreMethod (names = "clear" )
1254
1253
public abstract static class ClearNode extends CoreMethodNode {
1255
1254
@@ -1272,4 +1271,30 @@ public RubyString clear(RubyString string) {
1272
1271
}
1273
1272
}
1274
1273
1274
+ @ CoreMethod (names = "chr" )
1275
+ public abstract static class ChrNode extends CoreMethodNode {
1276
+
1277
+ public ChrNode (RubyContext context , SourceSection sourceSection ) {
1278
+ super (context , sourceSection );
1279
+ }
1280
+
1281
+ public ChrNode (ChrNode prev ) {
1282
+ super (prev );
1283
+ }
1284
+
1285
+ @ Specialization
1286
+ public RubyString chr (RubyString string ) {
1287
+ notDesignedForCompilation ();
1288
+ if (string .toString ().isEmpty ()) {
1289
+ return string ;
1290
+ } else {
1291
+ String head = string .toString ().substring (0 , 1 );
1292
+ ByteList byteString = ByteList .create (head );
1293
+ byteString .setEncoding (string .getBytes ().getEncoding ());
1294
+
1295
+ return string .getContext ().makeString (byteString );
1296
+ }
1297
+ }
1298
+ }
1299
+
1275
1300
}
You can’t perform that action at this time.
0 commit comments