Sha256: b223329862bb884b23f66154688fb7671b86eeeb2317c185369edd726fbdc2af

Contents?: true

Size: 445 Bytes

Versions: 1

Compression:

Stored size: 445 Bytes

Contents

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

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

# All other objects
class Object
  def tag *args, &block
    args.first ? HtmlTagBuilder.tag(*args, &block) : HtmlTagBuilder
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
html-tag-1.3.2 ./lib/html-tag/adapter.rb