Module: WrapIt::HTMLClass::ClassMethods

Defined in:
lib/wrap_it/html_class.rb

Overview

Class methods to include

Instance Method Summary collapse

Instance Method Details

#html_class(*args) ⇒ void

This method returns an undefined value.

Adds default html classes, thats are automatically added when element created.



213
214
215
216
# File 'lib/wrap_it/html_class.rb', line 213

def html_class(*args)
  @html_class.nil? || args += @html_class
  @html_class = HTMLClass.sanitize(*args)
end

#html_class_prefix(prefix = nil) ⇒ void

This method returns an undefined value.

Sets HTML class prefix. It used in switchers and enums



224
225
226
227
228
229
230
# File 'lib/wrap_it/html_class.rb', line 224

def html_class_prefix(prefix = nil)
  return(get_derived(:@html_class_prefix) || '') if prefix.nil?
  prefix.is_a?(String) || prefix.is_a?(Symbol) || fail(
    ArgumentError, 'prefix should be a String or Symbol'
  )
  @html_class_prefix = prefix.to_s
end