private IRubyObject aref(ThreadContext context, IRubyObject index_or_range) {
if (index_or_range instanceof RubyFixnum) {
Long index = (Long)index_or_range.toJava(Long.class);
return commonArefIndex(context, index);
} else if (index_or_range instanceof RubyRange) {
RubyRange range = (RubyRange)index_or_range;
Long start = (Long)range.first(context).toJava(Long.class);
Long last = (Long)range.last(context).toJava(Long.class);
// subvec returns from 'start' to element (- end 1)
if (range.exclude_end_p().isTrue()) {
return commonAref(context, start, null, last);
} else {
return commonAref(context, start, null, last + 1);
}
} else {