Class: BBLib::HTML::TagSet

Inherits:
Tag
  • Object
show all
Defined in:
lib/bblib/html/tag_set.rb

Overview

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.

Constant Summary

Constants inherited from Tag

BBLib::HTML::Tag::APPEND_ATTRIBUTES

Instance Method Summary collapse

Methods inherited from Tag

#add, #append_attribute, #merge, #render_attributes, #set_attribute, #to_s, #to_str

Methods included from Builder

#build, build

Methods included from Effortless

#_attrs, included

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class BBLib::HTML::Tag

Instance Method Details

#render(pretty: false, tabs: 0) ⇒ Object



9
10
11
# File 'lib/bblib/html/tag_set.rb', line 9

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

#render_content(pretty: false, tabs: 0) ⇒ Object



13
14
15
16
# File 'lib/bblib/html/tag_set.rb', line 13

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