Sha256: c6819e4c12fa7b4d33812b729ce473900fbdde13434da33a167ba14133615b85
Contents?: true
Size: 471 Bytes
Versions: 2
Compression:
Stored size: 471 Bytes
Contents
module ValidatesTelephone module Formatter def self.br(number) return nil if number.nil? number.gsub(/[\(\)-]/, "") =~ /^(\d{2})(\d{4})(\d{4})$/ return number if $1.nil? "(#{$1})#{$2}-#{$3}" end def self.usa(number) return nil if number.nil? number.gsub(/[\(\)-]/, "") =~ /^(\d{3})(\d{3})(\d{4})$/ return number if $1.nil? "(#{$1})#{$2}-#{$3}" end def self.any(number) number end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
validates_telephone-1.0.1 | lib/validates_telephone/formatter.rb |
validates_telephone-1.0.0 | lib/validates_telephone/formatter.rb |