class Grn2Drn::SchemaConverter
Public Class Methods
new(options={})
click to toggle source
# File lib/grn2drn/schema-converter.rb, line 30 def initialize(options={}) @options = options end
Public Instance Methods
convert(input)
click to toggle source
# File lib/grn2drn/schema-converter.rb, line 34 def convert(input) schema = Schema.new command_parser = Groonga::Command::Parser.new command_parser.on_command do |command| case command.name when "table_create" schema.on_table_create_command(command) when "column_create" schema.on_column_create_command(command) end end command_parser.on_load_value do |command, value| command.original_source.clear end input.each_line do |line| command_parser << line.force_encoding("UTF-8") end command_parser.finish schema.to_droonga_schema end