Module: OcrChallenge::BasicLandAndCellNumberParser

Includes:
BasicTenDigitTelecomParser
Included in:
IBusinessCardParser
Defined in:
lib/ocr_challenge/basic_land_and_cell_number_parser.rb

Overview

This module attempts to parse phone numbers which I w ill define as BOTH land lines and cell phone numbers. It will attempt to filter out fax numbers NOTE: This assumes the including class will have a ‘lines’ instance variable

Constant Summary collapse

FAX_REGEX =
/fax/i

Constants included from BasicTenDigitTelecomParser

OcrChallenge::BasicTenDigitTelecomParser::BASIC_NUMBER_REGEX

Instance Method Summary collapse

Methods included from BasicTenDigitTelecomParser

#get_matches

Instance Method Details

#parse_phone_numbersObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ocr_challenge/basic_land_and_cell_number_parser.rb', line 9

def parse_phone_numbers
  matching_lines = get_matches

  phone_number_lines = matching_lines.reject do |line|
    is_fax_number?(line)
  end

  phone_number_lines.map do |line|
    format(line, '-')
  end.sort
end