Sha256: fb290f3218fa34e62a52f2fb1c2c152c5b40e8f3b3fb17c70405070a9458c110

Contents?: true

Size: 345 Bytes

Versions: 2

Compression:

Stored size: 345 Bytes

Contents

module HaravanTheme
  module Filters
    class Blacklist
      attr_reader :patterns

      def initialize(pattern_strings=[])
        @patterns = pattern_strings.map { |p| Regexp.new(p)}
      end

      def select(list)
        list.select do |entry|
          patterns.none? { |pat| pat.match(entry) }
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
haravan_theme-0.0.26 lib/haravan_theme/filters/blacklist.rb
haravan_theme-0.0.25 lib/haravan_theme/filters/blacklist.rb