Class: HoboFields::Text
- Inherits:
-
String
- Object
- String
- HoboFields::Text
show all
- Defined in:
- lib/hobo_fields/text.rb
Constant Summary
collapse
- HTML_ESCAPE =
{ '&' => '&', '"' => '"', '>' => '>', '<' => '<' }
- COLUMN_TYPE =
:text
Instance Method Summary
collapse
Instance Method Details
#to_html(xmldoctype = true) ⇒ Object
9
10
11
|
# File 'lib/hobo_fields/text.rb', line 9
def to_html(xmldoctype = true)
gsub(/[&"><]/) { |special| HTML_ESCAPE[special] }.gsub("\n", "<br#{xmldoctype ? ' /' : ''}>\n")
end
|