Class: Kafo::DataTypeParser
- Inherits:
-
Object
- Object
- Kafo::DataTypeParser
- Defined in:
- lib/kafo/data_type_parser.rb
Constant Summary collapse
- TYPE_DEFINITION =
/^type\s+([^\s=]+)\s*=\s*(.+?)(\s+#.*)?\s*$/
Instance Attribute Summary collapse
-
#types ⇒ Object
readonly
Returns the value of attribute types.
Instance Method Summary collapse
-
#initialize(manifest) ⇒ DataTypeParser
constructor
A new instance of DataTypeParser.
- #register ⇒ Object
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
#types ⇒ Object (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
#register ⇒ Object
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 |