Class: GroongaClientModel::SchemaLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/groonga_client_model/schema_loader.rb

Instance Method Summary collapse

Constructor Details

#initialize(schema) ⇒ SchemaLoader

Returns a new instance of SchemaLoader.



21
22
23
# File 'lib/groonga_client_model/schema_loader.rb', line 21

def initialize(schema)
  @schema = schema
end

Instance Method Details

#loadObject



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/groonga_client_model/schema_loader.rb', line 25

def load
  Client.open do |client|
    parser = Groonga::Command::Parser.new
    parser.on_command do |command|
      client.execute(command)
    end
    @schema.each_line do |line|
      parser << line
    end
    parser.finish
  end
end