Class: HappyPhoneNumber::BeFormat

Inherits:
BaseFormat show all
Defined in:
lib/happy_phone_number/be_format.rb

Overview

Format for belgian phone numbers.

Instance Method Summary collapse

Methods inherited from BaseFormat

#initialize

Constructor Details

This class inherits a constructor from HappyPhoneNumber::BaseFormat

Instance Method Details

#formatObject

Format the phone number given belgian convention.

Returns the String formatted phone number.



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/happy_phone_number/be_format.rb', line 11

def format
  case @phone[0, 2]
  when "02", "03", "04", "08", "09"
    if @type == :national
      make_happy '2322'
    else
      internationalize
      make_happy '31322'
    end
  else
    if @type == :national
      make_happy '3222'
    else
      internationalize
      make_happy '32222'
    end
  end
end