Class: Groonga::SchemaDumper
- Inherits:
-
Object
- Object
- Groonga::SchemaDumper
- Defined in:
- lib/groonga/dumper.rb
Overview
スキーマの内容をRubyスクリプトまたはgrn式形式の文字列と して出力するクラス。
Defined Under Namespace
Classes: BaseSyntax, CommandSyntax, RubySyntax
Instance Method Summary collapse
- #dump ⇒ Object
-
#initialize(options = {}) ⇒ SchemaDumper
constructor
A new instance of SchemaDumper.
Constructor Details
#initialize(options = {}) ⇒ SchemaDumper
Returns a new instance of SchemaDumper.
107 108 109 |
# File 'lib/groonga/dumper.rb', line 107 def initialize(={}) @options = ( || {}).dup end |
Instance Method Details
#dump ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/groonga/dumper.rb', line 111 def dump database = @options[:database] if database.nil? context = @options[:context] || Groonga::Context.default database = context.database end return nil if database.nil? output = @options[:output] have_output = !output.nil? output ||= StringIO.new result = syntax(database, output).dump if have_output result else output.string end end |