Method: SimpleQS::Queue.check_queue_name

Defined in:
lib/simple_qs/queue.rb

.check_queue_name(name) ⇒ Object

Performs checks on queue name. Raises ArgumentError with message in case of constraint violation

Raises:

  • (ArgumentError)


272
273
274
275
276
277
278
279
280
281
282
# File 'lib/simple_qs/queue.rb', line 272

def check_queue_name(name)
  raise ArgumentError, "expected to be String, but got #{name.class.to_s}" unless name.class == String
  raise(
    ArgumentError,
    "should be maximum 80 characters long"
  ) if name.length > 80
  raise(
    ArgumentError,
    "should contain only alphanumeric characters, hyphens (-), and underscores (_)"
  ) if name =~ /[^a-zA-Z0-9\_\-]/
end