Created
May 31, 2018 23:06
-
-
Save pocke/5a3c604d8a4216a6a10d064b51028473 to your computer and use it in GitHub Desktop.
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 'ripper' | |
class RipperEventViewer < Ripper::SexpBuilderPP | |
(Ripper::PARSER_EVENTS + Ripper::SCANNER_EVENTS).each do |ev| | |
eval <<~RUBY | |
def on_#{ev}(*args) | |
super.tap do | |
puts "#{'*'*50} on_#{ev}" | |
pp(*args) | |
end | |
end | |
RUBY | |
end | |
end | |
RipperEventViewer.parse ARGF.read |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment