Skip to content

Instantly share code, notes, and snippets.

@rlb3
Last active December 21, 2015 01:19
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save rlb3/6227322 to your computer and use it in GitHub Desktop.
Save rlb3/6227322 to your computer and use it in GitHub Desktop.
bob.rb
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
@codeodor
Copy link

This was so fun.

@rlb3
Copy link
Author

rlb3 commented Aug 14, 2013

Very...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment