Class: UiBibz::Builders::DataHtmlOptionsBuilder
- Inherits:
-
Object
- Object
- UiBibz::Builders::DataHtmlOptionsBuilder
- Includes:
- ActionView::Helpers::SanitizeHelper
- Defined in:
- lib/ui_bibz/builders/data_html_options_builder.rb
Overview
Class to build html classes
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#html_options ⇒ Object
(also: #output)
Returns the value of attribute html_options.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#add(name, value: true) ⇒ Object
Add html data arguments.
-
#initialize(content, options, html_options) ⇒ DataHtmlOptionsBuilder
constructor
A new instance of DataHtmlOptionsBuilder.
Constructor Details
#initialize(content, options, html_options) ⇒ DataHtmlOptionsBuilder
Returns a new instance of DataHtmlOptionsBuilder.
10 11 12 13 14 15 16 17 18 19 |
# File 'lib/ui_bibz/builders/data_html_options_builder.rb', line 10 def initialize(content, , ) @content = content @options = @html_options = stimulus_data_html hotwire_data_html tooltip_data_html popover_data_html end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
8 9 10 |
# File 'lib/ui_bibz/builders/data_html_options_builder.rb', line 8 def content @content end |
#html_options ⇒ Object Also known as: output
Returns the value of attribute html_options.
7 8 9 |
# File 'lib/ui_bibz/builders/data_html_options_builder.rb', line 7 def @html_options end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
8 9 10 |
# File 'lib/ui_bibz/builders/data_html_options_builder.rb', line 8 def @options end |
Instance Method Details
#add(name, value: true) ⇒ Object
Add html data arguments
22 23 24 25 26 27 28 |
# File 'lib/ui_bibz/builders/data_html_options_builder.rb', line 22 def add(name, value: true) return if value.blank? && value != false [:data] = {} if [:data].nil? value = value.strip if value.is_a?(String) [:data].update({ name => value }) end |