[Groonga-commit] droonga/droonga-client-ruby at 03fb4f8 [master] Introduce new option to disable completion

Zurück zum Archiv-Index

YUKI Hiroshi null+****@clear*****
Fri Jan 16 17:39:46 JST 2015


YUKI Hiroshi	2015-01-16 17:39:46 +0900 (Fri, 16 Jan 2015)

  New Revision: 03fb4f8b57d41aa8eee152d2c0a082625c1100b3
  https://github.com/droonga/droonga-client-ruby/commit/03fb4f8b57d41aa8eee152d2c0a082625c1100b3

  Message:
    Introduce new option to disable completion

  Modified files:
    bin/droonga-request
    bin/droonga-send
    doc/text/news.md
    lib/droonga/client.rb

  Modified: bin/droonga-request (+7 -1)
===================================================================
--- bin/droonga-request    2015-01-16 17:31:22 +0900 (f1f5e33)
+++ bin/droonga-request    2015-01-16 17:39:46 +0900 (5b66d17)
@@ -32,6 +32,7 @@ options = {
   :receiver_port       => 0,
   :report_request      => false,
   :report_elapsed_time => true,
+  :completion          => true,
   :validation          => true,
 }
 
@@ -99,7 +100,12 @@ parser.on("--[no-]report-elapsed-time",
   options[:report_elapsed_time] = report_elapsed_time
 end
 parser.separator("")
-parser.separator("Misc:")
+parser.separator("Messages:")
+parser.on("--[no-]completion",
+          "Do completion of required fields for input message or not.",
+          "(#{options[:completion]})") do |completion|
+  options[:completion] = completion
+end
 parser.on("--[no-]validation",
           "Do validation for input message or not.",
           "(#{options[:validation]})") do |validation|

  Modified: bin/droonga-send (+8 -1)
===================================================================
--- bin/droonga-send    2015-01-16 17:31:22 +0900 (c55c2bf)
+++ bin/droonga-send    2015-01-16 17:39:46 +0900 (d7fca8b)
@@ -28,6 +28,7 @@ options.report_throughput = false
 options.default_protocol = "droonga"
 options.default_port     = 10031
 options.default_tag      = "droonga"
+options.completion       = true
 options.validation       = true
 
 servers = []
@@ -58,6 +59,7 @@ def parse_server(server, options)
     :port     => Integer(port),
     :protocol => protocol.to_sym,
     :tag      => tag,
+    :completion => options.completion,
     :validation => options.validation,
   }
 end
@@ -141,7 +143,12 @@ parser.on("--report-throughput",
   options.report_throughput = true
 end
 parser.separator("")
-parser.separator("Misc:")
+parser.separator("Messages:")
+parser.on("--[no-]completion",
+          "Do completion of required fields for input message or not.",
+          "(#{options.completion})") do |completion|
+  options.completion = completion
+end
 parser.on("--[no-]validation",
           "Do validation for input message or not.",
           "(#{options.validation})") do |validation|

  Modified: doc/text/news.md (+5 -2)
===================================================================
--- doc/text/news.md    2015-01-16 17:31:22 +0900 (920b9f5)
+++ doc/text/news.md    2015-01-16 17:39:46 +0900 (0343602)
@@ -2,10 +2,13 @@
 
 ## 0.2.1: 2005-01-29 (planned)
 
+ * Required fields of input messages are automatically completed by default.
  * Input messages are automatically validated by default.
  * droonga-send, droonga-request:
-   A new option `--[no-]validation` is introduced.
-   You should specify `--no-validation` to skip validation.
+   * A new option `--[no-]completion` is introduced.
+     You should specify `--no-completion` to send incomplete messages intentionally.
+   * A new option `--[no-]validation` is introduced.
+     You should specify `--no-validation` to send invalid messages intentionally.
 
 ## 0.2.0: 2014-11-29
 

  Modified: lib/droonga/client.rb (+8 -4)
===================================================================
--- lib/droonga/client.rb    2015-01-16 17:31:22 +0900 (71369d6)
+++ lib/droonga/client.rb    2015-01-16 17:39:46 +0900 (da7dc3b)
@@ -62,30 +62,34 @@ module Droonga
     # @option options [Integer] :timeout (5)
     #   The timeout value for connecting to, writing to and reading
     #   from Droonga Engine.
+    # @option options [Boolean] :completion (true)
+    #   Do or do not complete required fields of input messages.
     # @option options [Boolean] :validation (true)
     #   Do or do not validate input messages.
     def initialize(options={})
       @connection = create_connection(options)
-      @completer = MessageCompleter.new
+      unless options[:completion] == false
+        @completer = MessageCompleter.new
+      end
       unless options[:validation] == false
         @validator = MessageValidator.new
       end
     end
 
     def send(message, options={}, &block)
-      message =****@compl*****(message)
+      message =****@compl*****(message) if @completer
       @validator.validate(message) if @validator
       @connection.send(message, options, &block)
     end
 
     def request(message, options={}, &block)
-      message =****@compl*****(message)
+      message =****@compl*****(message) if @completer
       @validator.validate(message) if @validator
       @connection.request(message, options, &block)
     end
 
     def subscribe(message, options={}, &block)
-      message =****@compl*****(message)
+      message =****@compl*****(message) if @completer
       @validator.validate(message) if @validator
       @connection.subscribe(message, options, &block)
     end
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Zurück zum Archiv-Index