[Groonga-commit] droonga/fluent-plugin-droonga at 142b5a2 [master] Receive options

Back to archive index

YUKI Hiroshi yuki****@clear*****
Thu Sep 12 11:46:41 JST 2013


> new(options).convert(input)にするのがいいんじゃないかなぁと
> 思いました。

ご指摘ありがとうございます。反映しました。

> あと、Groonga::Commmand::Parserはこんな感じでストリームでパー
> スできるのでしばらくしたらそっちに移行するのがいいと思います。
> 今だと1つのコマンドしか対応できないので。

Parserのストリームの使い方というのがわからなくて(いつ誰がfinishを呼ぶべ
きなのか、とか)、とりあえず分かる所からでやってしまっておりました。
テストを作った後でもう一度チャレンジしてみます。


Kouhei Sutou wrote:
> new(options).convert(input)にするのがいいんじゃないかなぁと
> 思いました。
> 
> あと、Groonga::Commmand::Parserはこんな感じでストリームでパー
> スできるのでしばらくしたらそっちに移行するのがいいと思います。
> 今だと1つのコマンドしか対応できないので。
> 
>    parser = Groonga::Command::Parser.new
>    parser.on_command do |command|
>      # ...
>    end
>    parser.on_load_value do |command, value|
>      # ...
>    end
>    input.each_line do |line|
>      parser << line
>    end
>    parser.finish
> 
> 使用例: https://github.com/groonga/fluent-plugin-groonga/blob/master/lib/fluent/plugin/in_groonga.rb#L252
> 
> In <142b5a290e55f0dedcb1c4af61fa6fad1a47a419 �� jenkins.clear-code.com>
>    "[Groonga-commit] droonga/fluent-plugin-droonga �� 142b5a2 [master] Receive options" on Thu, 12 Sep 2013 11:16:47 +0900,
>    YUKI Hiroshi <null+groonga �� clear-code.com> wrote:
> 
>> YUKI Hiroshi	2013-09-12 11:16:47 +0900 (Thu, 12 Sep 2013)
>>
>>    New Revision: 142b5a290e55f0dedcb1c4af61fa6fad1a47a419
>>    https://github.com/droonga/fluent-plugin-droonga/commit/142b5a290e55f0dedcb1c4af61fa6fad1a47a419
>>
>>    Message:
>>      Receive options
>>
>>    Modified files:
>>      lib/groonga_command_converter.rb
>>
>>    Modified: lib/groonga_command_converter.rb (+3 -1)
>> ===================================================================
>> --- lib/groonga_command_converter.rb    2013-09-11 19:07:30 +0900 (b1b9eb7)
>> +++ lib/groonga_command_converter.rb    2013-09-12 11:16:47 +0900 (7758c48)
>> @@ -24,8 +24,10 @@ module Droonga
>>       def initialize
>>       end
>>   
>> -    def convert(input, &block)
>> +    def convert(input, options={}, &block)
>>         command = Groonga::Command::Parser.parse(input)
>> +      @options = options
>> +
>>         case command.name
>>         when "table_create"
>>           yield create_table_create_command(command)
> 
> _______________________________________________
> Groonga-commit mailing list
> Groonga-commit �� lists.sourceforge.jp
> http://lists.sourceforge.jp/mailman/listinfo/groonga-commit
> 

-- 
結城 洋志 <YUKI Hiroshi>
E-mail: yuki �� clear-code.com

株式会社クリアコード
〒113-0033 東京都文京区本郷3-27-12
           本郷デントビル2階
TEL : 03-6231-7270
FAX : 03-6231-7271
WWW : http://www.clear-code.com/




More information about the Groonga-commit mailing list
Back to archive index