Skip to content

Instantly share code, notes, and snippets.

@markbates
Created November 15, 2012 19:12
Show Gist options
  • Select an option

  • Save markbates/4080572 to your computer and use it in GitHub Desktop.

Select an option

Save markbates/4080572 to your computer and use it in GitHub Desktop.
SublimeREPL & Rails
require 'rubygems'
gem 'pry'
require 'pry'
PWD = ENV["PWD"]
env_rb = File.join(PWD, "config", "environment.rb")
FileUtils.cd PWD
if File.exists?(env_rb)
require env_rb
end
class PryInput
def readline(prompt)
$stdout.print prompt
$stdout.flush
$stdin.readline
end
end
class PryOutput
def puts(data="")
$stdout.puts(data.gsub('`', "'"))
$stdout.flush
end
def to_s
to_str
end
def to_str
File.join(PWD, "log", "pry.log")
end
end
Pry.config.input = PryInput.new()
Pry.config.output = PryOutput.new()
Pry.config.color = false
Pry.config.editor = ARGV[0]
Pry.config.auto_indent = false
Pry.config.correct_indent = false
Pry.start self
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment