class RQRCodeCore::QRCode

def minimum_version(limit: QRUtil.max_size, version: 1)

def minimum_version(limit: QRUtil.max_size, version: 1)
  raise QRCodeRunTimeError, "Data length exceed maximum capacity of version #{limit}" if version > limit
  max_size_bits = QRMAXBITS[error_correction_level][version - 1]
  size_bits = multi_segment? ? @data.sum { |seg| seg.size(version) } : @data.size(version)
  return version if size_bits < max_size_bits
  minimum_version(limit: limit, version: version + 1)
end