Last active
December 21, 2015 01:19
-
-
Save rlb3/6227322 to your computer and use it in GitHub Desktop.
bob.rb
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 'ripper' | |
def Object.const_missing(name) | |
klass = const_set name, Class.new | |
klass.class_eval do | |
def method_missing name, *args | |
file, line_num, _ = caller[0].split(':') | |
file_contents = File.open(file).read | |
result = file_contents.split("\n")[line_num.to_i-1] | |
Ripper.sexp(result)[1][0][2][1][0][1][1][1] | |
end | |
klass | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was so fun.