Class: PrettyStrings::Cleaner
- Inherits:
-
Object
- Object
- PrettyStrings::Cleaner
- Defined in:
- lib/pretty_strings.rb
Instance Attribute Summary collapse
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(text) ⇒ Cleaner
constructor
A new instance of Cleaner.
- #pretty ⇒ Object
Constructor Details
#initialize(text) ⇒ Cleaner
Returns a new instance of Cleaner.
6 7 8 |
# File 'lib/pretty_strings.rb', line 6 def initialize(text) @text = text end |
Instance Attribute Details
#text ⇒ Object (readonly)
Returns the value of attribute text.
5 6 7 |
# File 'lib/pretty_strings.rb', line 5 def text @text end |
Instance Method Details
#pretty ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/pretty_strings.rb', line 10 def pretty return '' if text.nil? || text.empty? remove_bracketed_numbers( remove_consecutive_dots( replace_symbol_with_bracket( remove_newlines( replace_tabs( remove_bracketed_code( ( scan_for_code( escape_text( sanitize_text( replace_bracket_with_symbol( escape_text( sanitize_text( replace_bracket_with_symbol( text )))))))))))))).squeeze(" ").strip end |