Last active
August 29, 2015 14:07
-
-
Save TikiTDO/77d09f58b6a72efb471c to your computer and use it in GitHub Desktop.
Logs the code in a block, and the result it produced
This file contains hidden or 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 'sourcify' | |
class Binding | |
def log_op(&block) | |
result = nil | |
source = block.to_source strip_enclosure: true | |
result = self.eval source | |
puts "Command: #{source} Returned: #{result}" | |
result | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment