Class: Readline::Ucomp

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

Overview

The Ucomp class provided to encapsulate typical filename completion procedure. You will not typically use this directly, but will instead use the Readline::USERNAME_COMPLETION_PROC.

Note that this feature currently only works on Unix systems since it ultimately uses the Etc module to iterate over a list of users.

Class Method Summary collapse

Class Method Details

.call(str) ⇒ Object



506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
# File 'lib/readline.rb', line 506

def self.call(str)
  matches = RbReadline.rl_completion_matches(str, :rl_username_completion_function)
  if (matches)
    result = []
    i = 0
    while(matches[i])
      result << matches[i].dup
      matches[i] = nil
      i += 1
    end
    matches = nil
    if (result.length >= 2)
      result.shift
    end
  else
    result = nil
  end
  return result
end