Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/omniboard/core_ext.rb
Constant Summary collapse
- HTML_ESCAPE_CHARS =
{ "&" => "&", ">" => ">", "<" => "<", '"' => """, "'" => "'" }
Instance Method Summary collapse
- #html_escape ⇒ Object
-
#sanitize ⇒ Object
TODO Fix up all of these.
- #sanitize_quotes ⇒ Object
Instance Method Details
#html_escape ⇒ Object
10 11 12 |
# File 'lib/omniboard/core_ext.rb', line 10 def html_escape HTML_ESCAPE_CHARS.reduce(self){ |str, (replace_this, with_this)| str.gsub(replace_this, with_this) } end |
#sanitize ⇒ Object
TODO Fix up all of these
15 16 17 |
# File 'lib/omniboard/core_ext.rb', line 15 def sanitize self.gsub('"','\"').gsub("<","<").gsub(">", ">") end |
#sanitize_quotes ⇒ Object
19 20 21 |
# File 'lib/omniboard/core_ext.rb', line 19 def sanitize_quotes self.gsub('"','"') end |