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.
210 211 212 |
# File 'lib/megatest/selector.rb', line 210 def initialize(pattern) @pattern = Regexp.new(pattern) end |
Class Method Details
.parse(arg) ⇒ Object
203 204 205 206 207 |
# File 'lib/megatest/selector.rb', line 203 def parse(arg) if match = arg.match(%r{\A/(.+)\z}) new(match[1]) end end |
Instance Method Details
#select(test_cases) ⇒ Object
214 215 216 217 218 |
# File 'lib/megatest/selector.rb', line 214 def select(test_cases) test_cases.select do |t| @pattern.match?(t.name) || @pattern.match?(t.id) end end |