Sha256: 75ccbc8cfc5f1aff22eb3ba588b53c2dcc36194fb2c33485fe66d18430ad7eea

Contents?: true

Size: 536 Bytes

Versions: 1

Compression:

Stored size: 536 Bytes

Contents

# Hash
unless {}.respond_to?(:tag)
  class Hash
    def tag node_name, inner_html=nil
      ::HtmlTag::Outbound.build node_name, self, inner_html
    end
  end
end

# String
unless ''.respond_to?(:tag)
  class String
    def tag node_name, opts={}
      ::HtmlTag::Outbound.build node_name, opts, self
    end
  end
end

# HtmlTag do ...
def HtmlTag *args, &block
  args[0] ||= :div

  if args[0].class == Hash
    args[1] = args[0]
    args[0] = :div
  end

  out = HtmlTag::Inbound.new self
  out.send(*args, &block)
  out.render
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
html-tag-3.0.0 ./lib/html-tag/globals.rb