20110128

ruby-openid's AX response returns arrays

As janrain gone mad and removed the openidenabled.com domain recently, along with ruby-openid gem rdocs (confusing the shit out of google and breaking links all over the internets), my ordoc command helps me out (bash on osx):
function ordoc() {
    open -a Firefox `gem environment gemdir`/doc/$1-*/rdoc/index.html
}
But this alone is not probably worth a post, while the following undocumented feature of the gem probably is.

When examining a (very successfully named) FetchResponse instance, as after:
ax_info = OpenID::AX::FetchResponse.
    from_success_response(request.env[Rack::OpenID::RESPONSE])
ax_info['http://axschema.org/whatever'] may actually be an array! Which may either be empty or contain one item — in my practice with google accounts.
Perfect ruby no-surprise thinking.
My solution is to convert the attribute value to string (ax_info[...].to_s) and then test it for blankness. I hope this will hold in any case.
Cheers, janrain.