Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/mask_submissions.rb

Instance Method Summary collapse

Instance Method Details

#mask_cc_numberObject



2
3
4
5
6
7
8
9
10
# File 'lib/mask_submissions.rb', line 2

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

#mask_csvObject



12
13
14
# File 'lib/mask_submissions.rb', line 12

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