Skip to content

Instantly share code, notes, and snippets.

@JoshCheek
Last active October 17, 2022 22:33
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 JoshCheek/ee139e1db8dfa67c844551113ba97596 to your computer and use it in GitHub Desktop.
Save JoshCheek/ee139e1db8dfa67c844551113ba97596 to your computer and use it in GitHub Desktop.
Stateful default hash values
🤘 = Hash.new(Lol = Class.new)
🤘[🤘].define_method(:bbq) { 🤘[🤘] }
class Omg < 🤘[:😈]
instance_eval { alias wtf new }
end
Omg.wtf.bbq # => Lol
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment