Method: Mysh::SmartSource#rebuild

Defined in:
lib/mysh/sources/smart_auto_complete.rb

#rebuild(str) ⇒ Object

Construct a new data list for auto-complete



18
19
20
21
22
23
24
25
26
27
# File 'lib/mysh/sources/smart_auto_complete.rb', line 18

def rebuild(str)
  if /(?<=\s|^)\$[a-z][a-z0-9_]*\z/ =~ str
    sym = $MATCH[1..-1].to_sym
    @active_source = nil
    return @str = $PREMATCH + MNV[sym] if MNV.key?(sym)
  end

  @active_source = (@prefix || str[0]) == '=' ? @quote_source : @auto_source
  @active_source.rebuild(str)
end