Class: Kafo::DataTypeParser

Inherits:
Object
  • Object
show all
Defined in:
lib/kafo/data_type_parser.rb

Constant Summary collapse

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(manifest) ⇒ DataTypeParser

Returns a new instance of DataTypeParser.



9
10
11
12
13
14
15
16
17
# File 'lib/kafo/data_type_parser.rb', line 9

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

Instance Attribute Details

#typesObject (readonly)

Returns the value of attribute types.



7
8
9
# File 'lib/kafo/data_type_parser.rb', line 7

def types
  @types
end

Instance Method Details

#registerObject



19
20
21
22
23
24
# File 'lib/kafo/data_type_parser.rb', line 19

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