Class: Groonga::DatabaseDumper
- Inherits:
-
Object
- Object
- Groonga::DatabaseDumper
- Defined in:
- lib/groonga/dumper.rb
Overview
データベースの内容をgrn式形式の文字列として出力するクラス。
Class Method Summary collapse
-
.dump(options = {}) ⇒ Object
Dump database.
Instance Method Summary collapse
-
#dump ⇒ Object
-
#initialize(options = {}) ⇒ DatabaseDumper
constructor
A new instance of DatabaseDumper.
Constructor Details
#initialize(options = {}) ⇒ DatabaseDumper
Returns a new instance of DatabaseDumper.
43 44 45 |
# File 'lib/groonga/dumper.rb', line 43 def initialize(={}) @options = end |
Class Method Details
.dump(options = {}) ⇒ Object
Dump database
TODO: document options paramter
37 38 39 40 |
# File 'lib/groonga/dumper.rb', line 37 def dump(={}) dumper = new() dumper.dump end |
Instance Method Details
#dump ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/groonga/dumper.rb', line 47 def dump = @options.dup have_output = !@options[:output].nil? [:output] ||= Dumper.default_output [:error_output] ||= Dumper.default_output if [:database].nil? [:context] ||= Groonga::Context.default [:database] = [:context].database end [:dump_schema] = true if [:dump_schema].nil? [:dump_indexes] = true if [:dump_indexes].nil? [:dump_tables] = true if [:dump_tables].nil? if [:dump_schema] or [:dump_indexes] schema_dumper = SchemaDumper.new(.merge(:syntax => :command)) end if [:dump_schema] dump_plugins() schema_dumper.dump_tables if schema_dumper.have_reference_columns? [:output].write("\n") schema_dumper.dump_reference_columns end end dump_tables() if [:dump_tables] if [:dump_indexes] and schema_dumper.have_index_columns? [:output].write("\n") schema_dumper.dump_index_columns end if have_output nil else [:output].string end end |