Sha256: f20c4f487d0faff9a68dedd54b1c2e22038aded70a33dab91233bc55e34546c1

Contents?: true

Size: 245 Bytes

Versions: 5

Compression:

Stored size: 245 Bytes

Contents

class SmsAero::Phone < String
  extend SmsAero::Callable

  private

  def initialize(value)
    phone = value.to_s.scan(/\d/).join[/[^0].*/].to_s
    raise "'#{value}' is not a valid phone" unless phone[/^\d{11,13}$/]
    super phone
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sms_aero-0.2.0 lib/sms_aero/phone.rb
sms_aero-0.1.3 lib/sms_aero/phone.rb
sms_aero-0.1.2 lib/sms_aero/phone.rb
sms_aero-0.1.1 lib/sms_aero/phone.rb
sms_aero-0.1.0 lib/sms_aero/phone.rb