Module: Kameleoon::Utils::Strval
- Defined in:
- lib/kameleoon/utils.rb
Class Method Summary collapse
Class Method Details
.secret(secret) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/kameleoon/utils.rb', line 50 def self.secret(secret) hid_ch = '*' vis_count = 4 return 'nil' if secret.nil? length = secret.length return hid_ch * length if length <= vis_count hidden_length = [length - vis_count, vis_count].max secret[0, length - hidden_length] + hid_ch * hidden_length end |