B
benny
Hi,
I'm wondering if there is a special reason for the class Hash not to have the methods +, += and <<
just like Array. I would find it intuitive if I could do something like this
testhash = Hash.new
testhash << {"some key" => "some value"}
or even
secondhash = {"some other key" => "some other value"}
testhash += secondhash
#-> {"some key" => "some value", "some other key" => "some other value"}
thats the behaviour of arrays and I know that I could extend the class Hash, so that its supported.
I simply want to know if there is a special reason why it is not supported by default.
benny
I'm wondering if there is a special reason for the class Hash not to have the methods +, += and <<
just like Array. I would find it intuitive if I could do something like this
testhash = Hash.new
testhash << {"some key" => "some value"}
or even
secondhash = {"some other key" => "some other value"}
testhash += secondhash
#-> {"some key" => "some value", "some other key" => "some other value"}
thats the behaviour of arrays and I know that I could extend the class Hash, so that its supported.
I simply want to know if there is a special reason why it is not supported by default.
benny