Module: TuiTui::TextSanitizer
- Defined in:
- lib/tui_tui/text_sanitizer.rb
Overview
Encoding hygiene for the render path: replaces malformed byte sequences so a string can be displayed safely instead of raising encoding errors. (Input acceptance — rejecting control keys — lives with the input model, TextInput.)
Class Method Summary collapse
Class Method Details
.sanitize(string) ⇒ Object
10 11 12 |
# File 'lib/tui_tui/text_sanitizer.rb', line 10 def sanitize(string) string.valid_encoding? ? string : string.scrub("?") end |