Class: AoPhoneNumber

Inherits:
Object
  • Object
show all
Defined in:
lib/ao_phone_number.rb

Constant Summary collapse

UNITEL_CODES =

TODO: Phone number codes can have only 2 digits without the third digit being 0.

%w[921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948]
MOVICEL_CODES =
%w[911 912 913 914 915 916 917 918 919 991 992 993 994 995 996 997 998]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(phone_number) ⇒ AoPhoneNumber



8
9
10
# File 'lib/ao_phone_number.rb', line 8

def initialize(phone_number)
  @phone_number = phone_number
end

Instance Attribute Details

#phone_numberObject

Returns the value of attribute phone_number.



6
7
8
# File 'lib/ao_phone_number.rb', line 6

def phone_number
  @phone_number
end

Instance Method Details

#movicel?Boolean



20
21
22
# File 'lib/ao_phone_number.rb', line 20

def movicel?
  formatted? && MOVICEL_CODES.include?(operator_code)
end

#unitel?Boolean



16
17
18
# File 'lib/ao_phone_number.rb', line 16

def unitel?
  formatted? && UNITEL_CODES.include?(operator_code)
end

#valid?Boolean



12
13
14
# File 'lib/ao_phone_number.rb', line 12

def valid?
  formatted? && operator_code?
end