I'm using
MyModule.constants.each do |c|
  #my loop
end
How do I get the VALUE of each constant rather than its name?
You're looking for Module#const_get:
irb(main):014:0> MyModule.constants.each do |c|
irb(main):015:1*   puts(c.to_s + "  " + MyModule.const_get(c).to_s)
irb(main):016:1> end
MY_CONST  5
=> [:MY_CONST]
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With