module RbNaCl::Util

def check_string(string, length, description)

Parameters:
  • description (String) -- Description of the string (used in the error)
  • length (Integer) -- The only acceptable length of the string
  • string (#to_str) -- The input string

Raises:
  • (RbNaCl::LengthError) - If the string is not the right length
  • (ArgumentError) - If we cannot convert to a string with #to_str
def check_string(string, length, description)
  check_string_validation(string)
  string = string.to_s
  check_length(string, length, description)
  string
end