Class: Ucenter::Interface::Utility

Inherits:
Base
  • Object
show all
Defined in:
lib/ucenter/interface/utility.rb

Instance Method Summary collapse

Methods inherited from Base

#db_client, #get, #initialize, #post

Constructor Details

This class inherits a constructor from Ucenter::Interface::Base

Instance Method Details

#explain_query(query_params) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/ucenter/interface/utility.rb', line 4

def explain_query(query_params)
  query_params = '' if query_params === {}
  # systemname=cets&responsible=sj ==> {"systemname"=>"cets","responsible"=>"sj"}
  # only very sample explain,
  # have not care about special char ,e.g. & = ...
  re = {}
  if query_params.nil? or query_params == ""
    return re # empty ,need not explain
  end
  querys = query_params.split("&")
  querys.each do | query |
    query_arr = query.split("=")
    re[query_arr[0]]=query_arr[1]
  end
  return re
end