You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: file_size_validator.rb
    path of file: ./repos/gitlabhq/lib
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

class FileSizeValidator < ActiveModel::EachValidator
  MESSAGES = { is: :wrong_size, minimum: :size_too_small, maximum: :size_too_big }.freeze
  CHECKS   = { is: :==, minimum: :>=, maximum: :<= }.freeze

  DEFAULT_TOKENIZER = -> (value) { value.split("") }.freeze
  RESERVED_OPTIONS  = [:minimum, :maximum, :within, :is, :tokenizer, :too_s
    
  def validate_each(record, attribute, value)
    raise(ArgumentError, "A CarrierWave::Uploader::Base object was expected") unless value.is_a? CarrierWave::Uploader::Base

    value = (options[:tokenizer] || DEFAULT_TOKENIZER).call(value) if value.is_a?(String)

    CHECKS.each do |key, validity_check|
      next unless check_value = options[key]

      check_value =
        case check_value
        when Integer
          check_value
        when Symbol
          record.public_send(check_value) # rubocop:disable GitlabSecurity/PublicSend
        end

      value ||= [] if key == :maximum

      value_size = value.size
      next if value_size.public_send(validity_check, check_value) # rubocop:disable GitlabSecurity/PublicSend

      errors_options = options.except(*RESERVED_OPTIONS)
      errors_options[:file_size] = help.number_to_human_size check_value

      default_message = options[MESSAGES[key]]
      errors_options[:message] ||= default_message if default_message

      record.errors.add(attribute, MESSAGES[key], **errors_options)
    end