Class: TestLauncher::Frameworks::Base::Searcher

Inherits:
Object
  • Object
show all
Defined in:
lib/test_launcher/frameworks/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_searcher) ⇒ Searcher

Returns a new instance of Searcher.



8
9
10
# File 'lib/test_launcher/frameworks/base.rb', line 8

def initialize(raw_searcher, **)
  @raw_searcher = raw_searcher
end

Instance Attribute Details

#raw_searcherObject (readonly)

Returns the value of attribute raw_searcher.



7
8
9
# File 'lib/test_launcher/frameworks/base.rb', line 7

def raw_searcher
  @raw_searcher
end

Instance Method Details

#by_line(file_pattern, line_number) ⇒ Object

Raises:

  • (NotImplementedError)


26
27
28
# File 'lib/test_launcher/frameworks/base.rb', line 26

def (file_pattern, line_number)
  raise NotImplementedError
end

#examples(query) ⇒ Object



18
19
20
# File 'lib/test_launcher/frameworks/base.rb', line 18

def examples(query)
  grep(example_name_regex(query))
end

#grep(regex) ⇒ Object



22
23
24
# File 'lib/test_launcher/frameworks/base.rb', line 22

def grep(regex)
  raw_searcher.grep(regex, file_pattern: file_name_pattern)
end

#test_files(query) ⇒ Object



12
13
14
15
16
# File 'lib/test_launcher/frameworks/base.rb', line 12

def test_files(query)
  raw_searcher
    .find_files(query)
    .select {|f| f.match(file_name_regex)}
end