GoldNumber
GoldNumber is a small utility that checks if a phone number can be considered Premium
What is a Gold Number?
A gold number is a premium phone number that is more "good looking", and easier to remember.
What classifies a number as "good looking" or easy to remember?
- "71 999999" - Identical numbers
- "71 123 321" - Palindrome => two reversed groups of numbers
- "71 123456" - Consecutive numbers in ascending order
- "71 654321" - Consecutive numbers in descending order
- "71 11 22 33" - Palindrome pairs :)
- "71 123 123" - 2 identical groups
- "71 91 91 91" - Repetitive groups
Installation
Add this line to your application's Gemfile:
gem 'GoldNumber'
And then execute:
$ bundle
Or install it yourself as:
$ gem install GoldNumber
Usage
You can require it in your application
require 'goldnumber'
GoldNumber::GoldNumber.new(12333333).valid? # => false
GoldNumber::GoldNumber.new(45454545).valid? # => true
In different countries, phone numbers have a different length/format and sometimes the phone carriers have a prefix. You can pass a second parameter in the initialization of the GoldNumber and the specified number of characters from the beginning of the number will be ignored.
require 'goldnumber'
GoldNumber::GoldNumber.new(12333333).valid? # => false
GoldNumber::GoldNumber.new(12333333, 2).valid? # => true
Contributing
- Fork it ( https://github.com/ellimist/GoldNumber/fork )
- 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 a new Pull Request