Sha256: c3514f978857c15af134dc226a0e4e03776dfa8d783f5edc83f80050b21262cd

Contents?: true

Size: 382 Bytes

Versions: 9

Compression:

Stored size: 382 Bytes

Contents

# frozen_string_literal: true
module ProxES
  module Helpers
    module Indices
      def filter(asked, against)
        return against.map { |a| a.gsub(%r{\.\*}, '*') } if asked == ['*'] || asked == []

        answer = []
        against.each do |pattern|
          answer.concat asked.select { |idx| idx =~ %r{#{pattern}} }
        end
        answer
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
proxes-0.4.0 lib/proxes/helpers/indices.rb
proxes-0.3.6 lib/proxes/helpers/indices.rb
proxes-0.3.5 lib/proxes/helpers/indices.rb
proxes-0.3.3 lib/proxes/helpers/indices.rb
proxes-0.3.2 lib/proxes/helpers/indices.rb
proxes-0.3.1 lib/proxes/helpers/indices.rb
proxes-0.3.0 lib/proxes/helpers/indices.rb
proxes-0.2.0 lib/proxes/helpers/indices.rb
proxes-0.1.0 lib/proxes/helpers/indices.rb