nerdEd / gtfs

Ruby lib for dealing with GTFS
http://www.edschmalzle.com
MIT License
61 stars 40 forks source link

do not raise exception when an optional source file is missing #27

Open flavray opened 9 years ago

flavray commented 9 years ago

Fix #12 - missing optional files normally do not raise GTFS::InvalidSourceException anymore

If an optional file is missing, parse_entity yields a new empty instance of StringIO, when calling read on this StringIO, an empty string will be returned causing parse_models to return an empty array. If a required file is missing, raise GTFS::InvalidSourceException as before.

I added a test on transfers field, transfers.txt is missing in valid_gtfs_missing_optional_files.zip but calling source.transfers does not raise an exception anymore :)