Sha256: a415cf3acdc8c0ea7d513b910ab1c9cdcc9976039e5f632833aad332a773c526

Contents?: true

Size: 285 Bytes

Versions: 27

Compression:

Stored size: 285 Bytes

Contents

module BrDanfe
  module DanfeLib
    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
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
br_danfe-0.11.1 lib/br_danfe/danfe_lib/phone.rb
br_danfe-0.11.0 lib/br_danfe/danfe_lib/phone.rb
br_danfe-0.10.1 lib/br_danfe/danfe_lib/phone.rb
br_danfe-0.10.0 lib/br_danfe/danfe_lib/phone.rb
br_danfe-0.8.0 lib/br_danfe/danfe_lib/phone.rb
br_danfe-0.7.7 lib/br_danfe/danfe_lib/phone.rb
br_danfe-0.7.6 lib/br_danfe/danfe_lib/phone.rb
br_danfe-0.7.5 lib/br_danfe/danfe_lib/phone.rb
br_danfe-0.7.4 lib/br_danfe/danfe_lib/phone.rb
br_danfe-0.7.3 lib/br_danfe/danfe_lib/phone.rb
br_danfe-0.7.2 lib/br_danfe/danfe_lib/phone.rb
br_danfe-0.7.1 lib/br_danfe/danfe_lib/phone.rb
br_danfe-0.7.0 lib/br_danfe/danfe_lib/phone.rb
br_danfe-0.6.1 lib/br_danfe/danfe_lib/phone.rb
br_danfe-0.6.0 lib/br_danfe/danfe_lib/phone.rb
br_danfe-0.5.2 lib/br_danfe/danfe_lib/phone.rb
br_danfe-0.5.1 lib/br_danfe/danfe_lib/phone.rb
br_danfe-0.5.0 lib/br_danfe/danfe_lib/phone.rb
br_danfe-0.4.3 lib/br_danfe/danfe_lib/phone.rb
br_danfe-0.4.2 lib/br_danfe/danfe_lib/phone.rb