Module: WrapIt::HTML::ClassMethods

Included in:
Base, WrapIt::HTML
Defined in:
lib/wrap_it/html.rb

Overview

WrapIt::HTML class methods

Instance Method Summary collapse

Instance Method Details

#html_class([html_class, ...]) ⇒ void

This method returns an undefined value.

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

Parameters:

  • html_class (String, Symbol, Array<String, Symbol>)

    HTML class. Converted to String



131
132
133
# File 'lib/wrap_it/html.rb', line 131

def html_class(*args)
  (@html_class ||= HTMLClass.new) << args
end

#html_class_prefix(prefix = nil) ⇒ void

This method returns an undefined value.

Sets HTML class prefix. It used in switchers and enums

Parameters:

  • prefix (String) (defaults to: nil)

    HTML class prefix



140
141
142
143
144
145
146
# File 'lib/wrap_it/html.rb', line 140

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