Module: DesignSystem::Helpers::CssHelper

Included in:
Generic::Builders::Base, Generic::FormBuilder
Defined in:
lib/design_system/helpers/css_helper.rb

Overview

Provides CSS helper methods

Instance Method Summary collapse

Instance Method Details

#css_class_options_merge(options, css_classes = []) {|css_classes| ... } ⇒ Object

This method merges the specified css_classes into the options hash

Yields:

  • (css_classes)


9
10
11
12
13
14
15
16
17
# File 'lib/design_system/helpers/css_helper.rb', line 9

def css_class_options_merge(options, css_classes = [], &)
  options = options.symbolize_keys
  css_classes += options[:class].split if options.include?(:class)
  yield(css_classes) if block_given?
  options[:class] = css_classes.join(' ') unless css_classes.empty?
  raise "Multiple css class definitions: #{css_classes.inspect}" unless css_classes == css_classes.uniq

  options
end