Determine whether a value is an ICCID, IMEI, or ESN.
Add this line to your application's Gemfile:
gem'cellularity'And then execute:
$ bundle
Or install it yourself as:
$ gem install cellularity
imei=123456789012345# It can be a string or a numberesn='0xabc12345'# The ESN class can also handle hex.iccid=12345678901234567890min=1234567890## Validate your values:Cellularity::Esn.new(esn).valid?# => trueCellularity::Esn.new(imei).valid?# => falseCellularity::Iccid.new(iccid).valid?# => trueCellularity::Min.new(min).valid?# => trueCellularity::Min.new(:invalid).valid?# => false# Dynamically determine your id type:Cellularity.determine_id_type(esn)# => :esnCellularity.determine_id_type(iccid)# => :iccid- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request