Class: TestLauncher::Search::Ag
- Inherits:
-
Object
- Object
- TestLauncher::Search::Ag
- Defined in:
- lib/test_launcher/search/ag.rb
Defined Under Namespace
Classes: Interface
Constant Summary collapse
- NotInRepoError =
Class.new(BaseError)
Instance Attribute Summary collapse
-
#interface ⇒ Object
readonly
Returns the value of attribute interface.
Instance Method Summary collapse
- #find_files(pattern) ⇒ Object
- #grep(regex, file_pattern: '*') ⇒ Object
-
#initialize(shell, interface = Interface.new(shell)) ⇒ Ag
constructor
A new instance of Ag.
Constructor Details
#initialize(shell, interface = Interface.new(shell)) ⇒ Ag
Returns a new instance of Ag.
34 35 36 37 |
# File 'lib/test_launcher/search/ag.rb', line 34 def initialize(shell, interface=Interface.new(shell)) @interface = interface Dir.chdir(root_path) # MOVE ME! end |
Instance Attribute Details
#interface ⇒ Object (readonly)
Returns the value of attribute interface.
32 33 34 |
# File 'lib/test_launcher/search/ag.rb', line 32 def interface @interface end |
Instance Method Details
#find_files(pattern) ⇒ Object
39 40 41 42 |
# File 'lib/test_launcher/search/ag.rb', line 39 def find_files(pattern) relative_pattern = strip_system_path(pattern) interface.ls_files(relative_pattern).map {|f| system_path(f)} end |
#grep(regex, file_pattern: '*') ⇒ Object
44 45 46 47 48 49 |
# File 'lib/test_launcher/search/ag.rb', line 44 def grep(regex, file_pattern: '*') results = interface.grep(regex, strip_system_path(file_pattern)) results.map do |result| interpret_grep_result(result) end end |