title: Iterate Hash constants in Ruby
body: <p>I have the following Ruby module:</p>
  
  <pre><code>module Test
    Constant1 = {
      :key1 =&gt; :value1,
      :key2 =&gt; :value2    
    }
  
    Constant2 = {
      :key1 =&gt; :value1,
      :key2 =&gt; :value2    
    }
  end
  </code></pre>
  
  <p>And I am trying to iterate through the declared Hash constants to print all the keys defined with the following code:</p>
  
  <pre><code>Test.constants.each do |constant|
    constant.keys.each do |key|
      puts "key: #{key}"
    end
  end
  </code></pre>
  
  <p>But I get a <code>NoMethodError: undefined method 'keys' for "Constant2":String</code> and I don't know how to convert that <code>String</code> into a real costant. Anyone knows how to do it?</p>