Sha256: 6a61cf519781413153edcce6c2c65d6d4a91be6c9833e8f5e27627acf417bebe

Contents?: true

Size: 266 Bytes

Versions: 10

Compression:

Stored size: 266 Bytes

Contents

class MembershipNumberFormatValidator < ActiveModel::EachValidator
  def validate_each(object, attribute, value)
    unless value =~ /\A(620272)(\d){10}\z/
      object.errors[attribute] << (options[:message] || "must be a valid membership number")
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
ama_validators-0.0.10 lib/ama_validators/membership_number_format_validator.rb
ama_validators-0.0.9 lib/ama_validators/membership_number_format_validator.rb
ama_validators-0.0.8 lib/ama_validators/membership_number_format_validator.rb
ama_validators-0.0.7 lib/ama_validators/membership_number_format_validator.rb
ama_validators-0.0.6 lib/ama_validators/membership_number_format_validator.rb
ama_validators-0.0.5 lib/ama_validators/membership_number_format_validator.rb
ama_validators-0.0.4 lib/ama_validators/membership_number_format_validator.rb
ama_validators-0.0.3 lib/ama_validators/membership_number_format_validator.rb
ama_validators-0.0.2 lib/ama_validators/membership_number_format_validator.rb
ama_validators-0.0.1 lib/ama_validators/membership_number_format_validator.rb