Skip to content

Commit fe45893

Browse files
committed
[Truffle] Remove 1.8 behaviour in Rubinius' String#include?
1 parent 6e85813 commit fe45893

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

core/src/main/ruby/jruby/truffle/core/rubinius/kernel/common/string.rb

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,7 @@
2929
class String
3030

3131
def include?(needle)
32-
if needle.kind_of? Fixnum
33-
needle = needle % 256
34-
str_needle = needle.chr
35-
else
36-
str_needle = StringValue(needle)
37-
end
38-
39-
!!find_string(str_needle, 0)
32+
!!find_string(StringValue(needle), 0)
4033
end
4134

4235
end

spec/ruby/core/string/include_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
it "raises a TypeError if other can't be converted to string" do
2424
lambda { "hello".include?([]) }.should raise_error(TypeError)
25+
lambda { "hello".include?('h'.ord) }.should raise_error(TypeError)
2526
lambda { "hello".include?(mock('x')) }.should raise_error(TypeError)
2627
end
2728
end

0 commit comments

Comments
 (0)