Module: PhoneNumbers
- Includes:
- UnescapeHtmlHelper
- Included in:
- BrilliantWebScraper
- Defined in:
- lib/parsers/phone_numbers.rb
Overview
Grep phonenumbers from ‘href=tel:’ attributes
Instance Method Summary collapse
Instance Method Details
#grep_phone_numbers(response) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/parsers/phone_numbers.rb', line 6 def grep_phone_numbers(response) return if response.nil? || response.empty? phone_number_regex = %r{(?im)href\s*=\s*(?:"|')?\s*tel:\s*(?:https?:)?\/*(?!#(?:"|'))([^"'\/<>\{\[]+)} phone_numbers = response.scan(phone_number_regex).flatten.uniq get_processed_phone_numbers(phone_numbers) end |