Sha256: 2989dac6bdefb401cccafaeeba769ae0f8c588b7d4df99b2377efeb223359603

Contents?: true

Size: 600 Bytes

Versions: 5

Compression:

Stored size: 600 Bytes

Contents

require 'kafo/data_type'

module Kafo
  class DataTypeParser
    TYPE_DEFINITION = /^type\s+([^\s=]+)\s*=\s*(.+?)(\s+#.*)?\s*$/

    attr_reader :types

    def initialize(manifest)
      @logger = KafoConfigure.logger
      @types = {}
      manifest.each_line do |line|
        if (type = TYPE_DEFINITION.match(line.force_encoding("UTF-8")))
          @types[type[1]] = type[2]
        end
      end
    end

    def register
      @types.each do |name,target|
        @logger.debug("Registering extended data type #{name}")
        DataType.register_type(name, target)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
kafo-7.2.0 lib/kafo/data_type_parser.rb
kafo-7.1.0 lib/kafo/data_type_parser.rb
kafo-7.0.0 lib/kafo/data_type_parser.rb
kafo-6.5.0 lib/kafo/data_type_parser.rb
kafo-6.4.1 lib/kafo/data_type_parser.rb