class String

Public Instance Methods

mask_cc_number() click to toggle source
# 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_csv() click to toggle source
# File lib/mask_submissions.rb, line 12
def mask_csv
  self.length.times.inject('') { |s, i| "#{s}*" }
end