Sha256: 5330e9c5e9bf6cf0b580741af5805de57a37b4b6963968d40b0d2f50a82fdf0e

Contents?: true

Size: 369 Bytes

Versions: 2

Compression:

Stored size: 369 Bytes

Contents

module ShopifyTheme
  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
shopify_theme-0.0.25 lib/shopify_theme/filters/command_input.rb
shopify_theme-0.0.24 lib/shopify_theme/filters/command_input.rb