Sha256: 6ce1b96587afc147ce5d083bee1b4248da05701cb9e7b26f5cb5560db19a8665
Contents?: true
Size: 557 Bytes
Versions: 8
Compression:
Stored size: 557 Bytes
Contents
# frozen-string-literal: true # class Roda module RodaPlugins # The h plugin adds an +h+ instance method that will HTML # escape the input and return it. # # The following example will return "<foo>" as the body. # # plugin :h # # route do |r| # h('<foo>') # end module H module InstanceMethods # HTML escape the input and return the escaped version. def h(s) ::Rack::Utils.escape_html(s.to_s) end end end register_plugin(:h, H) end end
Version data entries
8 entries across 8 versions & 1 rubygems