Class: FuzzyNotes::FuzzyFinder
- Inherits:
-
Object
- Object
- FuzzyNotes::FuzzyFinder
- Includes:
- Logger
- Defined in:
- lib/fuzzy_notes/fuzzy_finder.rb
Constant Summary
Constants included from Logger::Colors
Logger::Colors::CREATE_COLOR, Logger::Colors::DEFAULT_COLOR, Logger::Colors::DELETE_COLOR, Logger::Colors::EXPORT_COLOR, Logger::Colors::IMPORT_COLOR, Logger::Colors::NOTE_COLOR, Logger::Colors::NUMBER_COLOR, Logger::Colors::PATH_COLOR, Logger::Colors::USER_COLOR
Instance Attribute Summary collapse
-
#all_files ⇒ Object
readonly
Returns the value of attribute all_files.
-
#extensions ⇒ Object
readonly
Returns the value of attribute extensions.
-
#files_matching_all ⇒ Object
readonly
Returns the value of attribute files_matching_all.
-
#files_matching_extension ⇒ Object
readonly
Returns the value of attribute files_matching_extension.
-
#full_text_search ⇒ Object
readonly
Returns the value of attribute full_text_search.
-
#keywords ⇒ Object
readonly
Returns the value of attribute keywords.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(path, params = {}) ⇒ FuzzyFinder
constructor
A new instance of FuzzyFinder.
- #refresh ⇒ Object
Methods included from Logger
Constructor Details
#initialize(path, params = {}) ⇒ FuzzyFinder
Returns a new instance of FuzzyFinder.
8 9 10 11 12 13 14 |
# File 'lib/fuzzy_notes/fuzzy_finder.rb', line 8 def initialize(path, params = {}) @path = path log.debug "search path: #{path}" @keywords, @extensions, @search_type = params.values_at(:keywords, :extensions, :full_text_search) self.refresh end |
Instance Attribute Details
#all_files ⇒ Object (readonly)
Returns the value of attribute all_files.
6 7 8 |
# File 'lib/fuzzy_notes/fuzzy_finder.rb', line 6 def all_files @all_files end |
#extensions ⇒ Object (readonly)
Returns the value of attribute extensions.
6 7 8 |
# File 'lib/fuzzy_notes/fuzzy_finder.rb', line 6 def extensions @extensions end |
#files_matching_all ⇒ Object (readonly)
Returns the value of attribute files_matching_all.
6 7 8 |
# File 'lib/fuzzy_notes/fuzzy_finder.rb', line 6 def files_matching_all @files_matching_all end |
#files_matching_extension ⇒ Object (readonly)
Returns the value of attribute files_matching_extension.
6 7 8 |
# File 'lib/fuzzy_notes/fuzzy_finder.rb', line 6 def files_matching_extension @files_matching_extension end |
#full_text_search ⇒ Object (readonly)
Returns the value of attribute full_text_search.
6 7 8 |
# File 'lib/fuzzy_notes/fuzzy_finder.rb', line 6 def full_text_search @full_text_search end |
#keywords ⇒ Object (readonly)
Returns the value of attribute keywords.
6 7 8 |
# File 'lib/fuzzy_notes/fuzzy_finder.rb', line 6 def keywords @keywords end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/fuzzy_notes/fuzzy_finder.rb', line 6 def path @path end |
Instance Method Details
#refresh ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/fuzzy_notes/fuzzy_finder.rb', line 16 def refresh clear_results Find.find(*@path) do |file_path| if !File.directory?(file_path) @all_files << file_path if extension_match?(file_path) @files_matching_extension << file_path @files_matching_all << file_path if file_match_proc.call(file_path) end end end end |