Skip to content

Commit

Permalink
Showing 2 changed files with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -29,14 +29,7 @@
class String

def include?(needle)
if needle.kind_of? Fixnum
needle = needle % 256
str_needle = needle.chr
else
str_needle = StringValue(needle)
end

!!find_string(str_needle, 0)
!!find_string(StringValue(needle), 0)
end

end
1 change: 1 addition & 0 deletions spec/ruby/core/string/include_spec.rb
Original file line number Diff line number Diff line change
@@ -22,6 +22,7 @@

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

0 comments on commit fe45893

Please sign in to comment.