Sha256: d99a5e52469b5ce9b76e256c2df4c15d27c026ea1d1261e857e2137eb75177ab
Contents?: true
Size: 795 Bytes
Versions: 1
Compression:
Stored size: 795 Bytes
Contents
# Hash unless {}.respond_to?(:tag) class Hash def tag node_name, inner_html=nil HtmlTag().send node_name, self, inner_html end end end # String unless ''.respond_to?(:tag) class String def tag node_name, opts = nil HtmlTag().send node_name, self, opts end end end # HtmlTag do ... module HtmlTag class Proxy def initialize @pointer = HtmlTag::Inbound.new end def method_missing name, *args, &block @pointer .send(name, *args, &block) .join('') end end end def HtmlTag *args, &block args[0] ||= :div if args[0].class == Hash args[1] = args[0] args[0] = :div end if block out = HtmlTag::Inbound.new self out.send(*args, &block) out.render else HtmlTag::Proxy.new end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
html-tag-3.0.1 | ./lib/html-tag/globals.rb |