Skip to content

Instantly share code, notes, and snippets.

@tamird
Last active August 29, 2015 14:06
Show Gist options
  • Save tamird/977a7bb9c53b37298011 to your computer and use it in GitHub Desktop.
Save tamird/977a7bb9c53b37298011 to your computer and use it in GitHub Desktop.
Real constants in Ruby
Module.send(
:prepend,
Module.new do
def const_set(p1, p2)
p2.freeze unless p2.is_a?(Module)
super
end
end
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment