Sha256: 0bf87925c61c3c22c871417cb14e63177407720a27f8b5d34e37da0c4e8abc8e

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
      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
    HtmlTagBuilder
  end

  # Rails has tag methd defeined in views, in ActionView::Helpers::TagHelper
  # Access HtmlTagBuilder via xtag then
  def xtag
    HtmlTagBuilder
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

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