Sterile
Constants
Instance methods
The reverse of +encode_entities+. Turns HTML or numeric entities into their Unicode counterparts.
Turn Unicode characters into their HTML equivilents. If a valid HTML entity is not possible, it will create a numeric entity.
q{“Economy Hits Bottom,” ran the headline}.encode_entities # => “Economy Hits Bottom,” ran the headline
Transliterate to ASCII, downcase and format for URL permalink/slug by stripping out all non-alphanumeric characters and replacing spaces with a delimiter (defaults to '-').
"Hello World!".sluggerize # => "hello-world"
Format text with proper "curly" quotes, m-dashes, copyright, trademark, etc.
q{"He said, 'Away with you, Drake!'"}.smart_format # => “He said, ‘Away with you, Drake!’”
Transliterate to ASCII and strip out any HTML/XML tags.
"nåsty".sterilize # => "nasty"
Transliterate Unicode [and accented ASCII] characters to their plain-text ASCII equivalents. This is based on data from the stringex gem (https://github.com/rsl/stringex) which is in turn a port of Perl's Unidecode and ostensibly provides superior results to iconv. The optical conversion data is based on work by Eric Boehs at https://github.com/ericboehs/to_slug Passing an option of :optical => true will prefer optical mapping instead of more pedantic matches.
"ýůçký".transliterate # => "yucky"
Trim whitespace from start and end of string and remove any redundant whitespace in between.
" Hello world! ".transliterate # => "Hello world!"