Class: Ubi::Memoria::Phone
Overview
A Phone! mobile? landline? who is calling???
Instance Attribute Summary collapse
-
#number ⇒ Object
readonly
Returns the value of attribute number.
Attributes inherited from Base
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
==, extract_text, inherited, #initialize, key, name, parse, parse!, plural, #to_s
Constructor Details
This class inherits a constructor from Ubi::Memoria::Base
Instance Attribute Details
#number ⇒ Object (readonly)
Returns the value of attribute number.
5 6 7 |
# File 'lib/ubi/memorias/phone.rb', line 5 def number @number end |
Class Method Details
.regex(hint = nil) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/ubi/memorias/phone.rb', line 21 def regex(hint = nil) / (?:^|\s)((?:\+\(?\d{1,3}\W)?[\._\-\/\s]* \(?\s*?\d{2,3}\s*?\)?[\._\-\/\s]*\d{3,5} [\._\-\/\s]*\d{4,5})(?:\s|$) /x end |
Instance Method Details
#format ⇒ Object
11 12 13 |
# File 'lib/ubi/memorias/phone.rb', line 11 def format number && number.national end |
#parser ⇒ Object
7 8 9 |
# File 'lib/ubi/memorias/phone.rb', line 7 def parser @number = Phonelib.parse(text.gsub(/\D/, ''), hint) end |
#rfc ⇒ Object
15 16 17 |
# File 'lib/ubi/memorias/phone.rb', line 15 def rfc number && number.international end |