add key and value to the beginning of a hash ruby

To add a key and value to the beginning of a hash in Ruby, you can use the unshift method. Here's the explanation for each step:

  1. Create a new key-value pair using a symbol or string as the key and the corresponding value.
  2. Use the unshift method to add the newly created key-value pair to the beginning of the hash.
  3. The unshift method modifies the original hash by adding the new key-value pair at the beginning of the hash.