module PryCoolline

Constants

VERSION
Wrapper

Public Instance Methods

make_coolline() click to toggle source

@return [Coolline]

# File lib/pry-coolline/wrapper.rb, line 25
def make_coolline
  Coolline.new do |cool|
    cool.completion_word_boundaries =
      [" ", "\t", ",", ";", '"', "'", "`", "<", ">",
       "=", ";", "|", "{", "}", "(", ")", "-"]

    cool.word_boundaries = cool.completion_word_boundaries +
      [".", ":"]

    pry_history_file =
      if Gem::Version.new(Pry::VERSION) >= Gem::Version.new("0.13")
        Pry.config.history_file
      else
        Pry.config.history.file
      end

    # bring saved history into coolline
    cool.history_file = File.expand_path(pry_history_file)

    cool.transform_proc = proc do
      if Pry.color
        code = CodeRay.scan(cool.line, :ruby).term

        if Pry.config.coolline_paren_matching
          PryCoolline.apply_paren_matching(code, cool.pos)
        end

        code
      else
        cool.line
      end
    end
  end
end
make_input() click to toggle source

@return [Wrapper] An object usable as an input object for Pry.

# File lib/pry-coolline/wrapper.rb, line 61
def make_input
  Wrapper.new make_coolline
end