Sha256: 67e7d0780620d5b24af64d69a9342989f8cb00fd52d926c74cc46d2147553579

Contents?: true

Size: 243 Bytes

Versions: 4

Compression:

Stored size: 243 Bytes

Contents

module RubyAnything
  module Filterable
    def filter(text)
      patterns = text.split(/\s+/).map do |word|
        /#{word}/i
      end
      select do |e|
        patterns.empty? || patterns.any? { |p| p =~ e }
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-anything-0.0.4 lib/ruby-anything/filterable.rb
ruby-anything-0.0.3 lib/ruby-anything/filterable.rb
ruby-anything-0.0.2 lib/ruby-anything/filterable.rb
ruby-anything-0.0.1 lib/ruby-anything/filterable.rb