Sha256: cd6bb3d3b657013c8ae486891e1da23c58b24301957d693b2798932d8a270ef0

Contents?: true

Size: 632 Bytes

Versions: 6

Compression:

Stored size: 632 Bytes

Contents

# frozen_string_literal: true

module UiBibz::Utils
  # Utils methods can be used outside of Ui Bibz
  class Screwdriver
    include Singleton

    def self.join_classes(*classes)
      klasses = [*classes].flatten.map(&:to_s).compact.uniq.reject(&:blank?)
      klasses.empty? ? nil : klasses
    end

    def self.exclude_classes(html_classes, *classes)
      klasses = (html_classes || []).flatten.map(&:to_s).reject { |klass_name| [*classes].flatten.include?(klass_name.to_s) || klass_name.blank? }
      klasses.empty? ? nil : klasses
    end

    def self.uniq_word_in_string(str)
      str.split(/\s/).uniq
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
ui_bibz-2.5.6 lib/ui_bibz/utils/screwdriver.rb
ui_bibz-2.5.5 lib/ui_bibz/utils/screwdriver.rb
ui_bibz-2.5.3 lib/ui_bibz/utils/screwdriver.rb
ui_bibz-2.5.2 lib/ui_bibz/utils/screwdriver.rb
ui_bibz-2.5.1 lib/ui_bibz/utils/screwdriver.rb
ui_bibz-2.5.0 lib/ui_bibz/utils/screwdriver.rb