Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pivotal-validates_as_phone_number

Package Overview
Dependencies
Maintainers
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pivotal-validates_as_phone_number

  • 0.7.4
  • Rubygems
  • Socket score

Version published
Maintainers
4
Created
Source

ValidatesAsPhoneNumber

This Ruby on Rails plugin/gem implements an ActiveRecord validation helper called validates_as_phone_number which validates U.S. phone numbers. The helper acts as if validates_format_of was used with a regular expression that defines:

(000) 000 0000 (000) 000-0000 000.000.0000 000-000-0000 000-0000 000-000-0000x000 (extension can be up to 7 digits) 000-000-0000 x1234567 (extension can be up to 7 digits with or without leading space before 'x') 000-0000x000 (extension can be up to 7 digits)

Installation:

gem sources -a http://gems.github.com

Install the gem(s): sudo gem install pivotal-validates_as_phone_number

Add to environment.rb initializer block: config.gem 'pivotal-validates_as_phone_number', :version => '>=0.7.4', :lib => 'validates_as_phone_number', :source => 'http://gems.github.com'

Usage:

In your model file do something like:

class MyClass < ActiveRecord::Base validates_as_phone_number :work_phone, :message => 'Invalid work phone number format', :allow_nil => true end

Tests:

Some tests have been added.

License:

See the LICENSE file.

FAQs

Package last updated on 10 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc