Class: WAZ::Storage::ValidationRules

Inherits:
Object
  • Object
show all
Defined in:
lib/waz/storage/validation_rules.rb

Class Method Summary collapse

Class Method Details

.valid_name?(name) ⇒ Boolean

Validates that the Container/Queue name given matches with the requirements of Windows Azure.

-Container/Queue names must start with a letter or number, and can contain only letters, numbers, and the dash (-) character. -Every dash (-) character must be immediately preceded and followed by a letter or number. -All letters in a container name must be lowercase. -Container/Queue names must be from 3 through 63 characters long.

Returns:

  • (Boolean)


11
12
13
# File 'lib/waz/storage/validation_rules.rb', line 11

def valid_name?(name)
  name =~ /^[a-z0-9][a-z0-9\-]{1,}[^-]$/ && name.length < 64
end

.valid_table_name?(name) ⇒ Boolean

Validates that the Table name given matches with the requirements of Windows Azure.

-Table names must start with at least one lower / upper character. -Table names can have character or any digit starting from the second position. -Table names must be from 3 through 63 characters long.

Returns:

  • (Boolean)


20
21
22
# File 'lib/waz/storage/validation_rules.rb', line 20

def valid_table_name?(name)
  name =~ /^([a-z]|[A-Z]){1}([a-z]|[A-Z]|\d){2,62}$/
end