Module: Primer::ClassNameHelper
- Included in:
- Component, Forms::BaseComponent, Forms::Dsl::Input, Forms::PrimerBaseComponentWrapper, Forms::Utils
- Defined in:
- app/lib/primer/class_name_helper.rb
Overview
:nodoc:
Instance Method Summary collapse
Instance Method Details
#class_names(*args) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/lib/primer/class_name_helper.rb', line 9 def class_names(*args) [].tap do |classes| args.each do |class_name| case class_name when String classes << class_name if class_name.present? when Hash class_name.each do |key, val| classes << key if val end when Array classes << class_names(*class_name).presence end end classes.compact! classes.uniq! end.join(" ") end |