Class: Rpush::Apns::DeviceTokenFormatValidator

Inherits:
ActiveModel::Validator
  • Object
show all
Defined in:
lib/rpush/apns/device_token_format_validator.rb

Instance Method Summary collapse

Instance Method Details

#validate(record) ⇒ Object



5
6
7
8
9
# File 'lib/rpush/apns/device_token_format_validator.rb', line 5

def validate(record)
  if record.device_token !~ /^[a-z0-9]{64}$/i
    record.errors[:device_token] << "is invalid"
  end
end