Class: CommandT::Finder

Inherits:
Object
  • Object
show all
Defined in:
lib/command_t/finder.rb

Overview

Encapsulates a Scanner instance (which builds up a list of available files in a directory) and a Matcher instance (which selects from that list based on a search string).

Instance Method Summary collapse

Constructor Details

#initialize(path = Dir.pwd, options = {}) ⇒ Finder

Returns a new instance of Finder.



32
33
34
35
# File 'lib/command_t/finder.rb', line 32

def initialize path = Dir.pwd, options = {}
  @scanner = Scanner.new path, options
  @matcher = Matcher.new @scanner, options
end

Instance Method Details

#flushObject



43
44
45
# File 'lib/command_t/finder.rb', line 43

def flush
  @scanner.flush
end

#path=(path) ⇒ Object



47
48
49
# File 'lib/command_t/finder.rb', line 47

def path= path
  @scanner.path = path
end

#sorted_matches_for(str, options = {}) ⇒ Object

Options:

:limit (integer): limit the number of returned matches


39
40
41
# File 'lib/command_t/finder.rb', line 39

def sorted_matches_for str, options = {}
  @matcher.sorted_matches_for str, options
end