Sha256: 638e24e31e691fd791d29762dd5ee2abbac25de3cd9e6397c68cea6bf895d433

Contents?: true

Size: 369 Bytes

Versions: 2

Compression:

Stored size: 369 Bytes

Contents

module HaravanTheme
  module Filters
    class CommandInput
      attr_reader :patterns
      def initialize(inputs=[])
        @patterns = inputs.map { |i| Regexp.compile(i) }
      end

      def select(list)
        return list if patterns.empty?
        list.select { |entry|
          patterns.any? { |pat| pat.match(entry) }
        }
      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/command_input.rb
haravan_theme-0.0.25 lib/haravan_theme/filters/command_input.rb