Anyone care to explain why I’m getting an error here:
[~]$ irb
>> h = Hash
=> Hash
>> h["a"] = 100
NoMethodError: undefined method `[]=' for Hash:Class
from (irb):2
but not here:
>> h = {'dog' => 'canine'}
=> {"dog"=>"canine"}
>> h["a"] = 100
=> 100
You need to call
Hash.new. With your code you are assigning the Hash class to h, not an instance of it.