Class: Mysh::SmartSource
- Defined in:
- lib/mysh/sources/smart_auto_complete.rb
Overview
-
array_source.rb - An array as the source for auto-complete.
Instance Method Summary collapse
-
#initialize(options) ⇒ SmartSource
constructor
Create a new file/folder auto-data source.
-
#next ⇒ Object
Get the next string for auto-complete.
-
#rebuild(str) ⇒ Object
Construct a new data list for auto-complete.
Constructor Details
#initialize(options) ⇒ SmartSource
Create a new file/folder auto-data source. NOP
10 11 12 13 14 15 |
# File 'lib/mysh/sources/smart_auto_complete.rb', line 10 def initialize() @prefix = [:prefix] @auto_source = MiniReadline::AutoFileSource.new() @quote_source = MiniReadline::QuotedFileFolderSource.new() @active_source = nil end |
Instance Method Details
#next ⇒ Object
Get the next string for auto-complete
24 25 26 |
# File 'lib/mysh/sources/smart_auto_complete.rb', line 24 def next @active_source.next end |
#rebuild(str) ⇒ Object
Construct a new data list for auto-complete
18 19 20 21 |
# File 'lib/mysh/sources/smart_auto_complete.rb', line 18 def rebuild(str) @active_source = (@prefix || str[0]) == '=' ? @quote_source : @auto_source @active_source.rebuild(str) end |