module Pry::BondCompleter

Public Class Methods

build_completion_proc(target, pry=nil, commands=[""]) click to toggle source
# File lib/pry/completion.rb, line 7
def self.build_completion_proc(target, pry=nil, commands=[""])
  Pry.require_readline

  # If we're using libedit or bond gem not installed, don't use Bond.
  if Readline::VERSION =~ /editline/ || !defined?(Bond)
    Pry.config.completer = InputCompleter
    return InputCompleter.build_completion_proc(target, pry, commands)
  end

  if !@started
    @started = true
    start
  end

  Pry.current[:pry] = pry
  proc{ |*a| Bond.agent.call(*a) }
end
start() click to toggle source
# File lib/pry/completion.rb, line 25
def self.start
  Bond.start(:eval_binding => lambda{ Pry.current[:pry].current_context })
  Bond.complete(:on => /\A/) do |input|
    Pry.commands.complete(input.line,
                         :pry_instance => Pry.current[:pry],
                         :target       => Pry.current[:pry].current_context,
                         :command_set  => Pry.current[:pry].commands)
  end
end