Class: UiBibz::Utils::BreakdownClassNameGenerator
- Inherits:
-
Object
- Object
- UiBibz::Utils::BreakdownClassNameGenerator
- Defined in:
- lib/ui_bibz/utils/breakdown_class_name_generator.rb
Overview
Generate the col class name
Constant Summary collapse
- POSITIONING =
%i[num offset push pull order].freeze
- BREAKPOINTS =
UiBibz::Ui::Core::Component::BREAKPOINTS
- PARAMETERS =
BREAKPOINTS + POSITIONING + [:position]
Instance Method Summary collapse
-
#class_names ⇒ Object
Possible options 3 or md: 3 or md: { num: 3 }, xs: { num: 4 }.
-
#initialize(options = {}, klass_name = 'col') ⇒ BreakdownClassNameGenerator
constructor
A new instance of BreakdownClassNameGenerator.
Constructor Details
#initialize(options = {}, klass_name = 'col') ⇒ BreakdownClassNameGenerator
Returns a new instance of BreakdownClassNameGenerator.
10 11 12 13 |
# File 'lib/ui_bibz/utils/breakdown_class_name_generator.rb', line 10 def initialize( = {}, klass_name = 'col') @options = .is_a?(Integer) ? { num: } : @klass_name = klass_name end |
Instance Method Details
#class_names ⇒ Object
Possible options 3 or md: 3 or md: { num: 3 }, xs: { num: 4 }
17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ui_bibz/utils/breakdown_class_name_generator.rb', line 17 def class_names return @klass_name unless kl = [] @options.each do |key, value| kl << write_classes(key.to_sym, value) if BREAKPOINTS.include?(key.to_sym) end kl << write_classes(nil, @options) kl.delete_if(&:blank?) end |