Class: Squill::SquillFileSearcher
- Inherits:
-
Object
- Object
- Squill::SquillFileSearcher
- Defined in:
- lib/squill/squill_file_searcher.rb
Instance Method Summary collapse
Instance Method Details
#list ⇒ Object
15 16 17 18 |
# File 'lib/squill/squill_file_searcher.rb', line 15 def list results = `find #{squill_search_dir} -type f -name '*.squill' | sort` results.split("\n").map { |result| Squill::SquillFile.new(File.basename(result.strip).gsub(/.squill/,'')) } end |
#search(search_string) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/squill/squill_file_searcher.rb', line 4 def search(search_string) grep_results = `egrep -l '^#(Description|Name):.*#{search_string}.*$' #{search_argument} | sort` grep_results.split("\n").map { |result| squillfile = Squill::SquillFile.new(File.basename(result.strip).gsub(/.squill/,'')) { name_highlight: highlight(squillfile.name, search_string), description_highlight: highlight(squillfile.description, search_string) } } end |