Class: Mbeditor::CodeSearchService
- Inherits:
-
Object
- Object
- Mbeditor::CodeSearchService
- Defined in:
- app/services/mbeditor/code_search_service.rb
Constant Summary collapse
- JS_GLOBS =
%w[*.js *.jsx *.ts *.tsx *.js.jsx *.js.erb *.jsx.erb].freeze
- RG_AVAILABLE =
system("which rg > /dev/null 2>&1")
Class Method Summary collapse
Class Method Details
.call(pattern, workspace_root, globs: JS_GLOBS) ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'app/services/mbeditor/code_search_service.rb', line 12 def call(pattern, workspace_root, globs: JS_GLOBS) if RG_AVAILABLE run_rg(pattern, workspace_root, globs) else run_grep(pattern, workspace_root, globs) end rescue StandardError [] end |