Sha256: 65da91ad555a3dd687d52f912bf6d7d2d6b5673f988da13993e2a44fd46f444b
Contents?: true
Size: 506 Bytes
Versions: 4
Compression:
Stored size: 506 Bytes
Contents
class String def json_escape ERB::Util.json_escape self end def html_escape # ERB::Util.html_escape self Rack::Utils.escape_html self end JS_ESCAPE_MAP = { '\\' => '\\\\', '</' => '<\/', "\r\n" => '\n', "\n" => '\n', "\r" => '\n', '"' => '\\"', "'" => "\\'" } def js_escape gsub(/(\\|<\/|\r\n|[\n\r"'])/){JS_ESCAPE_MAP[$1]} end # String marks, like :format, :safe def marks; @marks ||= OpenObject.new end end
Version data entries
4 entries across 4 versions & 3 rubygems
Version | Path |
---|---|
rad_core-0.0.13 | lib/rad/support/string.rb |
crystal-0.0.13 | lib/crystal/support/string.rb |
crystal-0.0.12 | lib/crystal/support/string.rb |
crystal_ext-0.0.11 | lib/crystal/support/string.rb |