Avoid use of to_h due to lack of support in older rubies

Third attempt to deal with #15.