Sha256: bf1e872ecee7eb18acd2e1f2ef0df60bb5c20a52b62f46399290e71ba2abeb5f
Contents?: true
Size: 582 Bytes
Versions: 4
Compression:
Stored size: 582 Bytes
Contents
module RatPack module Tag def tag(name, contents = nil, attrs = {}, &block) attrs, contents = contents, nil if contents.is_a?(Hash) # contents = capture(&block) if block_given? open_tag(name, attrs) + contents.to_s + close_tag(name) end def open_tag(name, attrs = nil) "<#{name}#{' ' + attrs.to_html_attributes unless attrs.blank?}>" end def close_tag(name) "</#{name}>" end def self_closing_tag(name, attrs = nil) "<#{name}#{' ' + attrs.to_html_attributes if attrs && !attrs.empty?}/>" end end end
Version data entries
4 entries across 4 versions & 1 rubygems