Sha256: 9871f713a800998c657141af8ee83f1888f759d8cb39b52d4528e68e83053240
Contents?: true
Size: 842 Bytes
Versions: 5
Compression:
Stored size: 842 Bytes
Contents
module Munge module Helpers module Tag def empty_tag(name, options = {}) options_str = options.map { |k, v| %(#{k}="#{h(v)}") }.join(" ") if options_str == "" "<#{name} />" else "<#{name} #{options_str} />" end end def content_tag(name, content = nil, options = {}, &block) if content.is_a?(Hash) options = content content = nil end options_str = options.map { |k, v| %(#{k}="#{h(v)}") }.join(" ") content_str = if content content elsif block_given? capture(&block) else "" end "<#{name} #{options_str}>#{content_str}</#{name}>" end def h(string) CGI.escape_html(string.to_s) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems