Sha256: 3a186f028600c18829ed9f07d4d303977831e6e0e01c25a71d6aa92a833ec32f
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
module FitParser class File class Type def self.types @types ||= {} end def self.types=(value) @types = value end def self.get_type(name) return Type.types[name] if Type.types.has_key? name type = Types.get_type_definition name Type.types[name] = type ? new(type) : nil end def initialize(type) @type = type end def value(val) return nil unless is_valid(val) if @type.has_key? :method Types.send(@type[:method], val, @type[:values], @type[:parameters]) else values = @type[:values] value = values[val] if values return value unless value.nil? val end end private def is_valid(val) if @type.has_key? :invalid invalid_value = @type[:invalid] else invalid_value = Types.get_type_definition(@type[:basic_type])[:invalid] end return false if val == invalid_value true end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fit_parser-0.0.5 | lib/fit_parser/file/type.rb |