Ruby gem to validate UC alumni identifier numbers.
Provides a UC Student Number (número de alumno de la Pontificia Universidad Católica de Chile) validation method for a string or a model’s attribute.
Credits to Patricio López for his JS implementation.
Add this line to your application’s Gemfile:
gem 'uc_number_validator'
And then execute:
$ bundle
Or install it yourself as:
$ gem install uc_number_validator
If you want to validate a single string:
require 'uc_number_validator' # Unless working with Ruby on Rails
'1263476J'.valid_uc_number?
=> true
'1263476-J'.valid_uc_number?
=> false
If you want to validate a model attribute you just need to set uc_number: true
(like any model validation in Ruby on Rails):
class User < ActiveRecord::Base
attr_accessor :student_number
validates :student_number, uc_number: true
end
git checkout -b my-new-feature
)git commit -am 'add my feature'
)git push origin my-new-feature
)