class Bundler::Thor::LineEditor::Readline::PathCompletion - bundler-1.15.4 Documentation

# class Bundler::Thor::LineEditor::Readline::PathCompletion

### Attributes

text[R]

### Public Class Methods

new(text) click to toggle source

    # File lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb, line 54
    def initialize(text)
      @text = text
    end

### Public Instance Methods

matches() click to toggle source

    # File lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb, line 58
    def matches
      relative_matches
    end

### Private Instance Methods

absolute_matches() click to toggle source

    # 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

base_path() click to toggle source

    # File lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb, line 82
    def base_path
      "#{Dir.pwd}/"
    end

glob_pattern() click to toggle source

    # File lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb, line 78
    def glob_pattern
      "#{base_path}#{text}*"
    end

relative_matches() click to toggle source

    # 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