Sha256: c191a4195a45e9f80524222c92e939171a44c54a6d1f05e08034f5ac68e5a91b

Contents?: true

Size: 243 Bytes

Versions: 9

Compression:

Stored size: 243 Bytes

Contents

module BrDanfe
  class Phone
    def self.format(phone)
      if phone.length == 10
        phone.sub(/(\d{2})(\d{4})(\d{4})/, "(\\1) \\2-\\3")
      else
        phone.sub(/(\d{2})(\d{5})(\d{4})/, "(\\1) \\2-\\3")
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
br_danfe-0.0.9 lib/br_danfe/phone.rb
br_danfe-0.0.8 lib/br_danfe/phone.rb
br_danfe-0.0.7 lib/br_danfe/phone.rb
br_danfe-0.0.6 lib/br_danfe/phone.rb
br_danfe-0.0.5 lib/br_danfe/phone.rb
br_danfe-0.0.4 lib/br_danfe/phone.rb
br_danfe-0.0.3 lib/br_danfe/phone.rb
br_danfe-0.0.2 lib/br_danfe/phone.rb
br_danfe-0.0.1 lib/br_danfe/phone.rb