123456789_123456789_123456789_123456789_123456789_

Class: Bundler::Thor::LineEditor::Readline::PathCompletion

Relationships & Source Files
Inherits: Object
Defined in: lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(text) ⇒ PathCompletion

[ GitHub ]

  
# File 'lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb', line 54

def initialize(text)
  @text = text
end

Instance Attribute Details

#text (readonly, private)

[ GitHub ]

  
# File 'lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb', line 51

attr_reader :text

Instance Method Details

#absolute_matches (private)

[ GitHub ]

  
# 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 (private)

[ GitHub ]

  
# File 'lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb', line 82

def base_path
  "#{Dir.pwd}/"
end

#glob_pattern (private)

[ GitHub ]

  
# File 'lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb', line 78

def glob_pattern
  "#{base_path}#{text}*"
end

#matches

[ GitHub ]

  
# File 'lib/bundler/vendor/thor/lib/thor/line_editor/readline.rb', line 58

def matches
  relative_matches
end

#relative_matches (private)

[ GitHub ]

  
# 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