Skip to content

Instantly share code, notes, and snippets.

@quartzmo
Created May 25, 2011 03:30
Show Gist options
  • Save quartzmo/990268 to your computer and use it in GitHub Desktop.
Save quartzmo/990268 to your computer and use it in GitHub Desktop.
Hacking IRB WorkSpace
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