lib/fit4ruby/FitFileEntity.rb
def set_type(type)
      if @top_level_record
        Log.fatal "FIT file type has already been set to " +
                  "#{@top_level_record.class}"
      end
      case type
      when 4, 'activity'
        @top_level_record = Activity.new
        @type = 'activity'
      when 32, 'monitoring_b'
        @top_level_record = Monitoring_B.new
        @type = 'monitoring_b'
      when 44, 'metrics'
        @top_level_record = Metrics.new
        @type = 'metrics'
      else
        Log.error "Unsupported FIT file type #{type}"
        return nil
      end

      @top_level_record
    end
def set_type(type)
      if @top_level_record
        Log.fatal "FIT file type has already been set to " +
                  "#{@top_level_record.class}"
      end
      case type
      when 4, 'activity'
        @top_level_record = Activity.new
        @type = 'activity'
      when 32, 'monitoring_b'
        @top_level_record = Monitoring_B.new
        @type = 'monitoring_b'
      when 44, 'metrics'
        @top_level_record = Metrics.new
        @type = 'metrics'
      else
        Log.error "Unsupported FIT file type #{type}"
        return nil
      end

      @top_level_record
    end
Create a FitFileEntity.
 Set what kind of FIT file we are dealing with.
 @return The Ruby object that will hold the content of the FIT file. It's
 a derivative of FitDataRecord.