[Groonga-commit] groonga/groonga at 8d9bb38 [master] Fix variable scope

Back to archive index

Kouhei Sutou null+****@clear*****
Thu Dec 26 14:34:30 JST 2013


Kouhei Sutou	2013-12-26 14:34:30 +0900 (Thu, 26 Dec 2013)

  New Revision: 8d9bb382a9a12388f818f3f6249036444a1d67a7
  https://github.com/groonga/groonga/commit/8d9bb382a9a12388f818f3f6249036444a1d67a7

  Message:
    Fix variable scope
    
    The previous code works but it is not good manner. It just works
    accidentally.
    
    Local variable defined in block can't be accessable out of the block.
    
    In this case, "result" can be used because other "when" clause has the
    same name local variable is defined.

  Modified files:
    data/munin/groonga_status

  Modified: data/munin/groonga_status (+2 -2)
===================================================================
--- data/munin/groonga_status    2013-12-26 13:47:00 +0900 (e9daee9)
+++ data/munin/groonga_status    2013-12-26 14:34:30 +0900 (ef2a344)
@@ -44,8 +44,8 @@ def run(command, *args)
     result = `#{groonga} #{command} #{args.join(' ')} 2>&1`
     parse($?.success?, result)
   when "http"
-    Net::HTTP.start(@host, @port) do |http|
-      result = http.get("/d/#{command}")
+    result = Net::HTTP.start(@host, @port) do |http|
+      http.get("/d/#{command}")
     end
     parse(result.code == "200", result.body)
   end
-------------- next part --------------
HTML����������������������������...
下载 



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