R
Ronald Fischer
I wanted to distinguish between cases, where a variable
is of type Symbol, or Hash, or something other. My first
attempt failed:
case v.class
when Symbol
...
when Hash
...
else
...
end
Even if v was a Hash, processing endet up in the "else" part.
Indeed, a quick check with irb showed:
Hash =3D=3D=3D Hash # =3D> false
I solved my problem by changing my code to
case v.class.to_s
when 'Symbol'
...
when 'Hash'
...
else
...
end
But now I wonder why =3D=3D=3D is defined for classes that way - it =
seems to
*always* return false.=20
Ronald
--=20
Ronald Fischer <[email protected]>
Phone: +49-89-452133-162
is of type Symbol, or Hash, or something other. My first
attempt failed:
case v.class
when Symbol
...
when Hash
...
else
...
end
Even if v was a Hash, processing endet up in the "else" part.
Indeed, a quick check with irb showed:
Hash =3D=3D=3D Hash # =3D> false
I solved my problem by changing my code to
case v.class.to_s
when 'Symbol'
...
when 'Hash'
...
else
...
end
But now I wonder why =3D=3D=3D is defined for classes that way - it =
seems to
*always* return false.=20
Ronald
--=20
Ronald Fischer <[email protected]>
Phone: +49-89-452133-162