Created
May 24, 2011 14:25
-
-
Save banister/988794 to your computer and use it in GitHub Desktop.
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) | |
1: puts "hello, about to validate some code!" | |
2: # oops forgot to add a parameter! | |
pry(main)* show-method Pry#valid_expression? | |
From: /Users/john/ruby/projects/pry/lib/pry/pry_instance.rb @ line 403: | |
Number of lines: 3 | |
def valid_expression?(code) | |
!!Ripper::SexpBuilder.new(code).parse | |
end | |
pry(main)* play-method Pry#valid_expression? -l 1..1 | |
pry(main)* show-input | |
0: def validate_code(code) | |
1: puts "hello, about to validate some code!" | |
2: # oops forgot to add a parameter! | |
3: !!Ripper::SexpBuilder.new(code).parse | |
pry(main)* rue-2 | |
pry(main)* show-input | |
0: def validate_code(code) | |
1: puts "hello, about to validate some code!" | |
2: | |
3: !!Ripper::SexpBuilder.new(code).parse | |
pry(main)* end | |
=> nil | |
pry(main)> show-method validate_code | |
From: (pry) @ line 1: | |
Number of lines: 4 | |
def validate_code(code) | |
puts "hello, about to validate some code!" | |
!!Ripper::SexpBuilder.new(code).parse | |
end | |
pry(main)> validate_code("puts 'hello world!'") | |
hello, about to validate some code! | |
=> true | |
pry(main)> validate_code("def broken") | |
hello, about to validate some code! | |
=> false |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment