(#22363) Fix problem with integer string to Integer on Ruby 1.8.7

The problem was caused by the logic using the Kernel method
Integer(string, radix) which was introduced in Ruby 1.9.2. We do
not need to pass radix, since the string converted starts with 0, 0x,
or 0X in all cases.
(#22363) Make string and array access operation work as specified.

The implementation relied on Ruby to do the right thing for both
String and Array slice operations. Naturally there were differences
between Ruby 1.8.7 and Ruby 1.9.2. This lead to a revisit of the
specification and a more solid implementation.

For string, a string is always produced (never undef). For array, undef
is produced if a single element is requested (without count) and the
index is outside of range. For a subarray of any length, including 0, an
empty array is always produced if the given range is outside of the
array's range.

For both string and array, a negative start index enumerates from the
end, and a negative count computes the wanted range using first an end
enumeration, and then a computed count (start_index to end_index), if
this is an inverse range (extending to the "left", or if the range is
outside, an empty array / empty string is produced.

In both cases, if there is partial overlap to the left or the right,
the overlapping range is produced.
(#22363) Fix failing tests on Ruby 1.8.7

Tests that depended on hash having a defined order failed on
Ruby 1.8.7. This corrects the failing tests.