Last active
November 6, 2019 16:51
-
-
Save gr33n7007h/9c5cf969b64b15c288ee05b70f390ec6 to your computer and use it in GitHub Desktop.
TracePoint
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
#!/usr/bin/env ruby | |
require 'open3' | |
TracePoint.trace(:call) do |tp| | |
if tp.method_id == :capture3 | |
m = tp.self.method(tp.method_id) | |
m.parameters.each do |_, param| | |
puts "#{tp.method_id} called with #{tp.binding.local_variable_get(param)}" | |
end | |
end | |
end | |
Open3.capture3('ls -lhas') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment