Module: Rules::TurboHtmlAttributesRules
- Defined in:
- lib/rules/turbo_html_attributes_rules.rb
Overview
Provides rules for turbo html attributes It allows users to :method and :confirm attributes instead of data-turbo_method and data-turbo_confirm
Class Method Summary collapse
Class Method Details
.prepare_turbo_html_attributes(options:) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/rules/turbo_html_attributes_rules.rb', line 7 def self.prepare_turbo_html_attributes(options:) .reduce({}) do |hash, (key, value)| case key when :method, :confirm hash.deep_merge data: { "turbo_#{key}": value } else hash.merge key => value end end end |