Sha256: 3831b37af0eab8d1a40a5ae2b8d46f404c48fe54712249cd3780744e3d6fb6f5
Contents?: true
Size: 387 Bytes
Versions: 5
Compression:
Stored size: 387 Bytes
Contents
module HoboFields module Types class Text < String HTML_ESCAPE = { '&' => '&', '"' => '"', '>' => '>', '<' => '<' } COLUMN_TYPE = :text def to_html(xmldoctype = true) gsub(/[&"><]/) { |special| HTML_ESCAPE[special] }.gsub("\n", "<br#{xmldoctype ? ' /' : ''}>\n") end HoboFields.register_type(:text, self) end end end
Version data entries
5 entries across 5 versions & 1 rubygems