Sha256: 97e90dc7d3eaaf50932902e108a1dd483d7ffe174f1affb9125daef4c8ea4740

Contents?: true

Size: 562 Bytes

Versions: 1

Compression:

Stored size: 562 Bytes

Contents

module EscapeUtils
  module HtmlSafety
    if "".respond_to? :html_safe?
      def self.escape_once(s)
        s = s.to_s
        if s.html_safe?
          s.html_safe
        else
          yield(s).html_safe
        end
      end

      def _escape_html(s)
        if s.html_safe?
          s.to_s.html_safe
        else
          EscapeUtils.escape_html(s.to_s).html_safe
        end
      end
    else
      def self.escape_once(s)
        yield s.to_s
      end

      def _escape_html(s)
        EscapeUtils.escape_html(s.to_s)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
escape_utils-1.3.0 lib/escape_utils/html_safety.rb