Work around JRuby issue #1923.

String#start_with?() returns false on JRuby when used with an empty string. See
https://github.com/jruby/jruby/issues/1923 for more information.
This commit is contained in:
Yorick Peterse 2014-08-26 21:08:50 +02:00
parent bcbdf5e4e7
commit 338aeeb514
1 changed files with 2 additions and 1 deletions

View File

@ -855,7 +855,8 @@ module Oga
haystack_str = on_call_string(context, haystack)
needle_str = on_call_string(context, needle)
return haystack_str.start_with?(needle_str)
# https://github.com/jruby/jruby/issues/1923
return needle_str.empty? || haystack_str.start_with?(needle_str)
end
##