Sha256: 062a696150bf757fff563c774ec54748bdab75f3bf87f51251aa3c31e4fb467b

Contents?: true

Size: 757 Bytes

Versions: 11

Compression:

Stored size: 757 Bytes

Contents

# frozen_string_literal: true

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

    class << self
      def join_classes(*classes)
        klasses = Array(classes).flatten.filter_map(&:to_s).uniq.compact_blank
        klasses.empty? ? nil : klasses
      end

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

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

      def tapped?(block)
        block.present? && block.parameters.present?
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
ui_bibz-4.0.0.beta16 lib/ui_bibz/utils/screwdriver.rb
ui_bibz-4.0.0.beta15 lib/ui_bibz/utils/screwdriver.rb
ui_bibz-4.0.0.beta14 lib/ui_bibz/utils/screwdriver.rb
ui_bibz-4.0.0.beta13 lib/ui_bibz/utils/screwdriver.rb
ui_bibz-4.0.0.beta10 lib/ui_bibz/utils/screwdriver.rb
ui_bibz-4.0.0.beta9 lib/ui_bibz/utils/screwdriver.rb
ui_bibz-4.0.0.beta8 lib/ui_bibz/utils/screwdriver.rb
ui_bibz-4.0.0.beta7 lib/ui_bibz/utils/screwdriver.rb
ui_bibz-4.0.0.beta6 lib/ui_bibz/utils/screwdriver.rb
ui_bibz-4.0.0.beta4 lib/ui_bibz/utils/screwdriver.rb
ui_bibz-4.0.0.beta3 lib/ui_bibz/utils/screwdriver.rb