This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pry(main)> show-method for_ | |
From: (pry) @ line 0: | |
Number of lines: 6 | |
def for_(var, cond, inc) | |
while(cond.call) | |
yield var | |
inc.call | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'pry' | |
module PryDebug | |
class FileBreakpoint < Struct.new(:id, :file, :line) | |
def to_s | |
"breakpoint #{id} at #{file}:#{line}" | |
end | |
def is_at?(other_file, other_line) | |
other_file.end_with?(file) && other_line == line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'continuation' | |
class RestartableError < StandardError | |
attr_accessor :cc | |
def self.call(msg) | |
instance = new(msg) | |
returning = true | |
callcc{|c| instance.cc = c } | |
returning = !returning |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# Colors | |
require 'ap' | |
require 'term/ansicolor' | |
# Change some stupid monkey patches | |
class String | |
%w[gray red green yellow blue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pry(main)> import Pry::ExtendedCommands::Experimental | |
pry(main)> def validate_code | |
pry(main)* puts "hello, about to validate some code!" | |
pry(main)* show-input | |
0: def validate_code | |
1: puts "hello, about to validate some code!" | |
pry(main)* # oops forgot to add a parameter! | |
pry(main)* rue-0 def validate_code(code) | |
pry(main)* show-input | |
0: def validate_code(code) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
irb quirk in 1.9.2: | |
o = Object.new | |
def o.blah | |
eval("T = 10") | |
end | |
o | |
T #=> 10 (in IRB) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* Pry::Helpers::Color: | |
** bold | |
** colorize | |
** blue | |
** bright_black | |
** brigt_cyan | |
** bright_green | |
** brigt_magenta | |
** bright_purple | |
** bright_red |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Helpers | |
def use_a_helper | |
puts "test" | |
end | |
end | |
class Pry::CommandContext | |
include Helpers | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add this to the end of your development.rb and add | |
# | |
# gem 'pry' | |
# | |
# to your Gemfile and run bundle to install. | |
silence_warnings do | |
begin | |
require 'pry' | |
IRB = Pry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pry(main)> class SupBurg | |
pry(main)* def yo | |
pry(main)* puts 'swede' | |
pry(main)* end | |
pry(main)* end | |
=> nil | |
pry(main)> hist | |
0: class SupBurg | |
1: def yo | |
2: puts 'swede' |