Sha256: af7191e2d19a840a8d1b340bcd94f9e166c5471f4dd8b2567664a5bda5f931fe

Contents?: true

Size: 634 Bytes

Versions: 6

Compression:

Stored size: 634 Bytes

Contents

module BBLib
  module HTML
    # Similar to the default tag but isn't representative of a an HTML element.
    # Instead, this is a collection of nested HTML Elements, so only children of
    # TagSets are rendered to html.
    class TagSet < Tag
      attr_str :type, required: false, default: nil, allow_nil: true

      def render(pretty: false, tabs: 0)
        render_content(pretty: pretty, tabs: tabs)
      end

      def render_content(pretty: false, tabs: 0)
        return '' if children.empty?
        children.map { |tag| tag.render(pretty: pretty, tabs: tabs + 1) }.join
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
bblib-2.0.5 lib/bblib/html/tag_set.rb
bblib-2.0.4 lib/bblib/html/tag_set.rb
bblib-2.0.3 lib/bblib/html/tag_set.rb
bblib-2.0.1 lib/bblib/html/tag_set.rb
bblib-2.0.0 lib/bblib/html/tag_set.rb
bblib-1.0.2 lib/html/tag_set.rb