Sha256: b4f05f7ecfa36335ec643d6c7fce75b626117c0207cca968042711545dfc9594

Contents?: true

Size: 771 Bytes

Versions: 2

Compression:

Stored size: 771 Bytes

Contents

# Validates Xbox Live gamertags. From the Xbox Live website:
#
# bq. Gamertags can only contain letters, numbers, and spaces, and can't begin
# with a number.
#
# In addition we discovered that they have no minimum length but are no more
# than 15 characters, and also cannot start with a space.
#
# The following error message keys are used to localize invalid screen names.
#
# | @xbox_too_long@ | Gamertag is over 15 characters. |
# | @xbox_invalid_chars@ | Gamertag contains invalid characters. |
# | @xbox_invalid_first_char@ | Gamertag doesn't start with a letter. |
#
# @example
#   validates :steam_account, steam: true

class XboxLiveValidator < AccountNameValidator
  error_key_prefix 'xbox'
  max_length 15
  valid_chars 'A-Za-z0-9 '
  first_char 'A-Za-z'
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
validates_im-1.1.0 lib/xbox_live_validator.rb
validates_im-1.0.0 lib/xbox_live_validator.rb