Added to_path method to the allowed methods in constructor

This allows to pass a Pathname object to the constructor
Added a friendly exception message
test passing Pathname object to constructor