Created
May 25, 2011 03:30
-
-
Save quartzmo/990268 to your computer and use it in GitHub Desktop.
Hacking IRB WorkSpace
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 'irb/workspace' | |
module IRB | |
class WorkSpace | |
alias evaluate__orig evaluate | |
def evaluate(ctx, stmts, file=__FILE__, line=__LINE__) | |
result = evaluate__orig(ctx,stmts,file,line) | |
if result.is_a?(Numeric) | |
result + 1 | |
elsif result.is_a?(String) | |
result.reverse | |
else | |
!result | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment