Class: CgAppBase::Phone

Inherits:
ActiveRecord::Base
  • Object
show all
Includes:
AttributesNormalizer
Defined in:
app/models/cg_app_base/phone.rb

Instance Method Summary collapse

Methods included from AttributesNormalizer

#excluded_normalized_attrs, #normalize_attributes

Instance Method Details

#format_phone_noObject



24
25
26
# File 'app/models/cg_app_base/phone.rb', line 24

def format_phone_no
  self.phone_no = self.phone_no.tr('^0-9', '').strip
end

#short_phone_noObject



28
29
30
31
32
33
34
# File 'app/models/cg_app_base/phone.rb', line 28

def short_phone_no
  area_code_right_indx = self.phone_no.size - 8
  return self.phone_no unless area_code_right_indx > -1

  area_code_right_indx = 2 if area_code_right_indx > 2
  self.phone_no[(area_code_right_indx + 1)..9]
end