Class: DBA::RowParser
- Inherits:
-
Object
- Object
- DBA::RowParser
- Defined in:
- lib/dba/row_parser.rb
Instance Method Summary collapse
-
#initialize(table_schema) ⇒ RowParser
constructor
A new instance of RowParser.
- #parse(string) ⇒ Object
Constructor Details
#initialize(table_schema) ⇒ RowParser
Returns a new instance of RowParser.
7 8 9 |
# File 'lib/dba/row_parser.rb', line 7 def initialize(table_schema) @table_schema = table_schema end |
Instance Method Details
#parse(string) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/dba/row_parser.rb', line 11 def parse(string) string.strip.split("\n").each_with_object({}) do |line, hash| key, value = line.split(/:\s*/, 2) column_name = key.to_sym hash[column_name] = value_parse(column_name, value) end end |