Fix for MRI/JRuby 1.9.3 which don't implement Struct#to_h

The call to `alias` to_h fails in older versions of ruby.
Added a check to ensure the method is defined before attempting
to alias.