Skip to content

Instantly share code, notes, and snippets.

@aereal
Created June 22, 2011 11:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aereal/1039879 to your computer and use it in GitHub Desktop.
Save aereal/1039879 to your computer and use it in GitHub Desktop.
class ::Object
def func(name, &block)
self.class.send(:define_method, name, &block)
end
end
func :unko do |len| "unko".each_char.map {|ch| ch * len.to_i }.join end
unko 5 # -> "uuuuunnnnnkkkkkooooo"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment