Class: Megatest::Selector::NameMatchFilter

Inherits:
Object
  • Object
show all
Defined in:
lib/megatest/selector.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pattern) ⇒ NameMatchFilter

Returns a new instance of NameMatchFilter.



195
196
197
# File 'lib/megatest/selector.rb', line 195

def initialize(pattern)
  @pattern = Regexp.new(pattern)
end

Class Method Details

.parse(arg) ⇒ Object



188
189
190
191
192
# File 'lib/megatest/selector.rb', line 188

def parse(arg)
  if match = arg.match(%r{\A/(.+)\z})
    new(match[1])
  end
end

Instance Method Details

#select(test_cases) ⇒ Object



199
200
201
202
203
# File 'lib/megatest/selector.rb', line 199

def select(test_cases)
  test_cases.select do |t|
    @pattern.match?(t.name) || @pattern.match?(t.id)
  end
end