File tree Expand file tree Collapse file tree 3 files changed +11
-23
lines changed
spec/truffle/tags/core/string
java/org/jruby/truffle/nodes/core
ruby/core/rubinius/common Expand file tree Collapse file tree 3 files changed +11
-23
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -1214,25 +1214,6 @@ public RubyEncoding encoding(RubyString string) {
1214
1214
}
1215
1215
}
1216
1216
1217
- @ CoreMethod (names = "end_with?" , required = 1 )
1218
- public abstract static class EndWithNode extends CoreMethodNode {
1219
-
1220
- public EndWithNode (RubyContext context , SourceSection sourceSection ) {
1221
- super (context , sourceSection );
1222
- }
1223
-
1224
- public EndWithNode (EndWithNode prev ) {
1225
- super (prev );
1226
- }
1227
-
1228
- @ Specialization
1229
- public boolean endWith (RubyString string , RubyString b ) {
1230
- notDesignedForCompilation ();
1231
-
1232
- return string .toString ().endsWith (b .toString ());
1233
- }
1234
- }
1235
-
1236
1217
@ CoreMethod (names = "force_encoding" , required = 1 )
1237
1218
public abstract static class ForceEncodingNode extends CoreMethodNode {
1238
1219
Original file line number Diff line number Diff line change @@ -527,6 +527,17 @@ def codepoints
527
527
end
528
528
end
529
529
530
+ def end_with? ( *suffixes )
531
+ suffixes . each do |original_suffix |
532
+ suffix = Rubinius ::Type . check_convert_type original_suffix , String , :to_str
533
+ unless suffix
534
+ raise TypeError , "no implicit conversion of #{ original_suffix . class } into String"
535
+ end
536
+ return true if self [ -suffix . length , suffix . length ] == suffix
537
+ end
538
+ false
539
+ end
540
+
530
541
def to_sub_replacement ( result , match )
531
542
index = 0
532
543
while index < @num_bytes
You can’t perform that action at this time.
0 commit comments