Class: GroongaQueryLog::ResponseComparer

Inherits:
Object
  • Object
show all
Defined in:
lib/groonga-query-log/response-comparer.rb

Instance Method Summary collapse

Constructor Details

#initialize(command, response1, response2, options = {}) ⇒ ResponseComparer

Returns a new instance of ResponseComparer.



20
21
22
23
24
25
26
27
# File 'lib/groonga-query-log/response-comparer.rb', line 20

def initialize(command, response1, response2, options={})
  @command = command
  @response1 = response1
  @response2 = response2
  @options = options.dup
  @options[:care_order] = true if @options[:care_order].nil?
  @options[:ignored_drilldown_keys] ||= []
end

Instance Method Details

#same?Boolean

Returns:

  • (Boolean)


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/groonga-query-log/response-comparer.rb', line 29

def same?
  if error_response?(@response1) or error_response?(@response2)
    if error_response?(@response1) and error_response?(@response2)
      same_error_response?
    else
      false
    end
  else
    case @command.name
    when "select", "logical_select"
      same_select_response?
    when "logical_range_filter"
      same_range_filter_response?
    when "status"
      same_cache_hit_rate?
    else
      same_response?
    end
  end
end