Class: Broutes::Formats::Factory
- Inherits:
-
Object
- Object
- Broutes::Formats::Factory
- Defined in:
- lib/broutes/formats/factory.rb
Instance Method Summary collapse
-
#get(format) ⇒ Object
Public : factory method.
Instance Method Details
#get(format) ⇒ Object
Public : factory method
format - Symbol describing the format [:gpx_track, :tcx, :fit]
Returns a route file parser
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/broutes/formats/factory.rb', line 9 def get(format) case format when :gpx_track, 'application/gpx+xml', /\.gpx$/ GpxTrack.new when :tcx, 'application/vnd.garmin.tcx+xml', /\.tcx$/ Tcx.new when :fit, 'application/vnd.ant.fit', /\.fit$/ FitFile.new else raise ArgumentError.new("Unrecognised format #{format}. Supported formats are :gpx_track, :tcx, :fit") end end |