class Roda::RodaPlugins::TypecastParams::Params

def [](key)

if +key+ is an integer, or hash otherwise.
Return a new Params instance for the given +key+. The value of +key+ should be an array
def [](key)
  @subs ||= {}
  if sub = @subs[key]
    return sub
  end
  if @obj.is_a?(Array)
    unless key.is_a?(Integer)
      handle_error(key, :invalid_type, "invalid use of non-integer key for accessing array: #{key.inspect}", true)
    end
  else
    if key.is_a?(Integer)
      handle_error(key, :invalid_type, "invalid use of integer key for accessing hash: #{key}", true)
    end
  end
  v = @obj[key]
  v = yield if v.nil? && block_given?
  begin
    sub = self.class.nest(v, Array(@nesting) + [key])
  rescue => e
    handle_error(key, :invalid_type, e, true)
  end
  @subs[key] = sub
  sub.sub_capture(@capture, @symbolize)
  sub
end