class Bundler::Thor::LineEditor::Readline::PathCompletion
Attributes
text[R]
Public Class Methods
# File lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb, line 54 def initialize(text) @text = text end
Public Instance Methods
# File lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb, line 58 def matches relative_matches end
Private Instance Methods
# File lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb, line 68
def absolute_matches
Dir[glob_pattern].map do |path|
if File.directory?(path)
"#{path}/"
else
path
end
end
end # File lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb, line 82
def base_path
"#{Dir.pwd}/"
end # File lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb, line 78
def glob_pattern
"#{base_path}#{text}*"
end # File lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb, line 64
def relative_matches
absolute_matches.map { |path| path.sub(base_path, "") }
end
Ruby Core © 1993–2017 Yukihiro Matsumoto
Licensed under the Ruby License.
Ruby Standard Library © contributors
Licensed under their own licenses.