Sha256: f14dab1941dd5c16c8abe84ff43e58d914e1fd2949400f4ddc895c2b50c06966

Contents?: true

Size: 287 Bytes

Versions: 74

Compression:

Stored size: 287 Bytes

Contents

class String
  def mask_cc_number
    masked = ''

    if self.gsub(/\D+/i, '').match(/^(\d\d)(.+)(\d\d\d\d)$/)
      masked = $1 + $2.length.times.inject('') { |s, i| "#{s}*" } + $3
    end

    masked
  end

  def mask_csv
    self.length.times.inject('') { |s, i| "#{s}*" }
  end
end

Version data entries

74 entries across 74 versions & 1 rubygems

Version Path
piggybak-0.7.7 lib/mask_submissions.rb
piggybak-0.7.6 lib/mask_submissions.rb
piggybak-0.7.5 lib/mask_submissions.rb
piggybak-0.6.34 lib/mask_submissions.rb
piggybak-0.7.4 lib/mask_submissions.rb
piggybak-0.7.3 lib/mask_submissions.rb
piggybak-0.7.2 lib/mask_submissions.rb
piggybak-0.7.1 lib/mask_submissions.rb
piggybak-0.7.0 lib/mask_submissions.rb
piggybak-0.6.33 lib/mask_submissions.rb
piggybak-0.6.32 lib/mask_submissions.rb
piggybak-0.6.31 lib/mask_submissions.rb
piggybak-0.6.30 lib/mask_submissions.rb
piggybak-0.6.29 lib/mask_submissions.rb
piggybak-0.6.28 lib/mask_submissions.rb
piggybak-0.6.27 lib/mask_submissions.rb
piggybak-0.6.26 lib/mask_submissions.rb
piggybak-0.6.25 lib/mask_submissions.rb
piggybak-0.6.24 lib/mask_submissions.rb
piggybak-0.6.23 lib/mask_submissions.rb