lib/fit4ruby/FitDefinitionField.rb in fit4ruby-2.0.0 vs lib/fit4ruby/FitDefinitionField.rb in fit4ruby-3.0.0

- old
+ new

@@ -1,11 +1,11 @@ #!/usr/bin/env ruby -w # encoding: UTF-8 # # = FitDefinitionField.rb -- Fit4Ruby - FIT file processing library for Ruby # -# Copyright (c) 2014 by Chris Schlaeger <cs@taskjuggler.org> +# Copyright (c) 2014, 2017, 2018 by Chris Schlaeger <cs@taskjuggler.org> # # This program is free software; you can redistribute it and/or modify # it under the terms of version 2 of the GNU General Public License as # published by the Free Software Foundation. # @@ -13,10 +13,11 @@ require 'bindata' require 'time' require 'fit4ruby/FitDefinitionFieldBase' require 'fit4ruby/Log' require 'fit4ruby/GlobalFitMessage' +require 'fit4ruby/FitTypeDefs' module Fit4Ruby # The FitDefinitionField models the part of the FIT file that contains the # template definition for a field of a FitMessageRecord. It should match the @@ -43,10 +44,10 @@ (field = @global_message_definition.fields_by_number[field_number]) @name = field.respond_to?('name') ? field.name : "choice_#{field_number}" @type = field.respond_to?('type') ? field.type : nil - if @type && (td = @@TypeDefs[checked_base_type_number]) && + if @type && (td = FIT_TYPE_DEFS[checked_base_type_number]) && td[0] != @type Log.warn "#{@global_message_number}:#{@name} must be of type " + "#{@type}, not #{td[0]}" end else