Class: Fluffery::Utils::Internal

Inherits:
Object
  • Object
show all
Defined in:
lib/fluffery/utils/internal.rb

Class Method Summary collapse

Class Method Details

.merge_html_classes(options, classes) ⇒ Object

Merge any new classes with existing html classes



8
9
10
11
12
13
14
# File 'lib/fluffery/utils/internal.rb', line 8

def self.merge_html_classes(options, classes)
  classes = [classes].flatten
  options.stringify_keys!
  return options.merge!('class' => classes.join(' ')) unless options.has_key?('class')
  old_classes = options['class'].split(' ')
  options.merge!('class' => [classes, old_classes].flatten.join(' '))
end