Ruby: can I name the class of a particular variable? is there something like “is_a?”?

What is a simple / elegant way in Ruby to tell if a particular variable is a Hash or an Array? – Stack Overflow

The answer is of course: yes, you can.
And: yes, exactly.

XmlSimple treats elements with attributes as Hash, w/o attributes they are simply String.

“googlecl-0.9.12 -> googlecl-0.9.13” brought a change, where a specific element now does not have attributes any longer, and this broke my code, that reads “google contacts list … –fields=xml“.

Solved one of my two urgent home software problems.


Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.