Class: Minitest::Distributed::Filters::IncludeFilter

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Includes:
FilterInterface
Defined in:
lib/minitest/distributed/filters/include_filter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(filter) ⇒ IncludeFilter

Returns a new instance of IncludeFilter.



15
16
17
18
19
20
# File 'lib/minitest/distributed/filters/include_filter.rb', line 15

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

Instance Attribute Details

#filterObject (readonly)

Returns the value of attribute filter.



12
13
14
# File 'lib/minitest/distributed/filters/include_filter.rb', line 12

def filter
  @filter
end

Instance Method Details

#call(runnable) ⇒ Object



23
24
25
26
27
28
29
30
31
# File 'lib/minitest/distributed/filters/include_filter.rb', line 23

def call(runnable)
  # rubocop:disable Style/CaseEquality
  if filter === runnable.name || filter === DefinedRunnable.identifier(runnable)
    [runnable]
  else
    []
  end
  # rubocop:enable Style/CaseEquality
end