Skip to content

Instantly share code, notes, and snippets.

@jaredatron
Created July 25, 2009 03:51
Show Gist options
  • Select an option

  • Save jaredatron/154683 to your computer and use it in GitHub Desktop.

Select an option

Save jaredatron/154683 to your computer and use it in GitHub Desktop.
class Ass
def self.make_a_method(name, *org_args)
class_eval do
def temp_method(*args, &block)
puts args.inspect
puts org_args.inspect
puts block_given?.inspect
puts yield.inspect
end
end
class_eval %(
alias_method :#{name}, :temp_method
remove_method :temp_method
)
end
end
class Butt < Ass
make_a_method :fart, 'in','your','face','ruby',69
end
a = Butt.new
a.fart 'in','your','face' do
'no way'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment