Method: TextActions#hide_text

Defined in:
lib/asker/lang/text_actions.rb

#hide_text(input_text) ⇒ Object



182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
# File 'lib/asker/lang/text_actions.rb', line 182

def hide_text(input_text)
  input = input_text.clone
  if count_words(input) < 2 && input.size < 10
    output = "[*]"
  else
    output = ""
    input.each_char do |char|
      if ' !|"@#$%&/()=?¿¡+*(){}[],.-_<>'.include? char
        output += char
      else
        output += "?"
      end
    end
  end
  output
end