Class: StringIndex

Inherits:
Object
  • Object
show all
Defined in:
lib/vimamsa/file_finder.rb

Instance Method Summary collapse

Constructor Details

#initializeStringIndex

Returns a new instance of StringIndex.



9
10
11
12
# File 'lib/vimamsa/file_finder.rb', line 9

def initialize()
  @idx = StrIdx::StringIndex.new
  @idx.setDirSeparator("/")
end

Instance Method Details

#add(str, id) ⇒ Object



22
23
24
# File 'lib/vimamsa/file_finder.rb', line 22

def add(str, id)
  @idx.add(str, id)
end

#find(str, minChars: 2) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/vimamsa/file_finder.rb', line 14

def find(str, minChars: 2)
  minChars = 3 if minChars.class != Integer
  minChars = 2 if minChars < 2
  minChars = 6 if minChars > 6 #TODO: implement option in C++

  @idx.find(str)
end