MaskingField

This gem is data masking.

Installation

gem 'masking_field',git: "[email protected]:ShigekiDoumae/masking_field.git"

Usage

It's plain.

class User < ApplicationRecord
  masking_to :phone_number
end

User.first.phone_number #=>"**********"

String fixed.

class User < ApplicationRecord
  masking_to :phone_number, fixed: "000-0000-0000"
end

User.first.phone_number #=>"000-0000-0000"

Auto generate to random strings. gen_type is required.type is lowercase,uppercase and integer gen_length is not required. default is 10.

class User < ApplicationRecord
  masking_to :phone_number, gen_type: "lowercase", gen_length: 5
end

User.first.phone_number #=>"bfugj" it's random!