Class: Mysh::SmartSource

Inherits:
Object
  • Object
show all
Defined in:
lib/mysh/smart_source.rb

Overview

  • array_source.rb - An array as the source for auto-complete.

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ SmartSource

Create a new file/folder auto-data source. NOP


10
11
12
13
# File 'lib/mysh/smart_source.rb', line 10

def initialize(options)
  @auto_source = MiniReadline::AutoFileSource.new(options)
  @quote_source = MiniReadline::QuotedFileFolderSource.new(options)
end

Instance Method Details

#nextObject

Get the next string for auto-complete


22
23
24
# File 'lib/mysh/smart_source.rb', line 22

def next
  @active_source.next
end

#rebuild(str) ⇒ Object

Construct a new data list for auto-complete


16
17
18
19
# File 'lib/mysh/smart_source.rb', line 16

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