Skip to content

Instantly share code, notes, and snippets.

@nuclearsandwich
Created April 16, 2012 00:55
Show Gist options
  • Save nuclearsandwich/2395667 to your computer and use it in GitHub Desktop.
Save nuclearsandwich/2395667 to your computer and use it in GitHub Desktop.
Possbile Pry indentation bug inside indented input with heredocs
Pry's handling of heredocs within existing indented
blocks such as method definitions. Steps to reproduce:
1. start pry
2. start a method definition
3. Open <<EOF style heredoc (as opposed to <<-EOF)
4. Type any text
5. Close the heredoc
6. End the method
7. Observe that the input buffer does not close until it is cleared with '!'
Probable cause: The outre indentation level is not stripped from the space-sensitive HEREDOC thus it can never close.
└─> pry --version
Pry version 0.9.8.4 on Ruby 1.9.3
└─> pry
[1] pry(main)> <<HEREDOC
[1] pry(main)* Bobloblaw's lawblog
[1] pry(main)* HEREDOC
=> "Bobloblaw's lawblog\n"
[2] pry(main)> def paste
[2] pry(main)* <<HEREDOC
[2] pry(main)* Bobloblaw's lawblog
[2] pry(main)* HEREDOC
[2] pry(main)* end
[2] pry(main)* end
[2] pry(main)* end
[2] pry(main)* end
[2] pry(main)* !
Input buffer cleared!
[3] pry(main)> def paste2
[3] pry(main)* <<-HEREDOC
[3] pry(main)* Bobloblaw's lawblog
[3] pry(main)* HEREDOC
[3] pry(main)* end
=> nil
[4] pry(main)>
# Second Case: if block
[1] pry(main)> if true
[1] pry(main)* <<HERE
[1] pry(main)* now
[1] pry(main)* HERE
[1] pry(main)* end
[1] pry(main)* end
[1] pry(main)* end
[1] pry(main)*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment