Sha256: 45d94c61254703f9e64e8e5a421e9dfb68db64630285b90f9ae4420da4f946c2

Contents?: true

Size: 953 Bytes

Versions: 12

Compression:

Stored size: 953 Bytes

Contents

# typed: strict
# frozen_string_literal: true

module Minitest
  module Distributed
    module Filters
      class IncludeFilter
        extend T::Sig
        include FilterInterface

        sig { returns(T.any(String, Regexp)) }
        attr_reader :filter

        sig { params(filter: T.any(String, Regexp)).void }
        def initialize(filter)
          @filter = filter
          if filter.is_a?(String) && (match_info = filter.match(%r%/(.*)/%))
            @filter = Regexp.new(T.must(match_info[1]))
          end
        end

        sig { override.params(runnable: Minitest::Runnable).returns(T::Array[Minitest::Runnable]) }
        def call(runnable)
          # rubocop:disable Style/CaseEquality
          if filter === runnable.name || filter === DefinedRunnable.identifier(runnable)
            [runnable]
          else
            []
          end
          # rubocop:enable Style/CaseEquality
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
minitest-distributed-0.2.11 lib/minitest/distributed/filters/include_filter.rb
minitest-distributed-0.2.10 lib/minitest/distributed/filters/include_filter.rb
minitest-distributed-0.2.9 lib/minitest/distributed/filters/include_filter.rb
minitest-distributed-0.2.8 lib/minitest/distributed/filters/include_filter.rb
minitest-distributed-0.2.7 lib/minitest/distributed/filters/include_filter.rb
minitest-distributed-0.2.6 lib/minitest/distributed/filters/include_filter.rb
minitest-distributed-0.2.5 lib/minitest/distributed/filters/include_filter.rb
minitest-distributed-0.2.2 lib/minitest/distributed/filters/include_filter.rb
minitest-distributed-0.2.4 lib/minitest/distributed/filters/include_filter.rb
minitest-distributed-0.2.3 lib/minitest/distributed/filters/include_filter.rb
minitest-distributed-0.2.1 lib/minitest/distributed/filters/include_filter.rb
minitest-distributed-0.2.0 lib/minitest/distributed/filters/include_filter.rb