Class: Megatest::Selector::NameMatchFilter
- Inherits:
-
Object
- Object
- Megatest::Selector::NameMatchFilter
- Defined in:
- lib/megatest/selector.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(pattern) ⇒ NameMatchFilter
constructor
A new instance of NameMatchFilter.
- #select(test_cases) ⇒ Object
Constructor Details
#initialize(pattern) ⇒ NameMatchFilter
Returns a new instance of NameMatchFilter.
199 200 201 |
# File 'lib/megatest/selector.rb', line 199 def initialize(pattern) @pattern = Regexp.new(pattern) end |
Class Method Details
.parse(arg) ⇒ Object
192 193 194 195 196 |
# File 'lib/megatest/selector.rb', line 192 def parse(arg) if match = arg.match(%r{\A/(.+)\z}) new(match[1]) end end |
Instance Method Details
#select(test_cases) ⇒ Object
203 204 205 206 207 |
# File 'lib/megatest/selector.rb', line 203 def select(test_cases) test_cases.select do |t| @pattern.match?(t.name) || @pattern.match?(t.id) end end |