Given
module Foo
A = 1
B = 2
end
Imagine there's a huge list of constants defined in Foo instead of just 2.
I want to freeze all the constants in Foo, so I add this:
module Foo
A = 1
B = 2
constants.each {|c| const_get(c).freeze }
end
It seems a waste to have to construct an array of constant names and
then call const_get on each one. Is there any way to get the constants
directly?