Method: Lookbook::TagComponent#initialize

Defined in:
app/components/lookbook/tag_component.rb

#initialize(tag: :div, name: nil, cloak: false, **html_attrs) ⇒ TagComponent

Returns a new instance of TagComponent.



6
7
8
9
10
11
12
13
# File 'app/components/lookbook/tag_component.rb', line 6

def initialize(tag: :div, name: nil, cloak: false, **html_attrs)
  @tag = tag
  html_attrs[:data] ||= {}
  html_attrs[:data][:component] = name if name.present?
  html_attrs[:"x-cloak"] = true if cloak == true
  html_attrs[self.class.escape_attribute_key] = false
  @html_attrs = html_attrs
end