Class: ImageDiff::Differ::Results::List

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Singleton
Defined in:
lib/image_diff/differ/results/list.rb

Overview

Results list

Instance Method Summary collapse

Constructor Details

#initializeList

Returns a new instance of List.



15
16
17
# File 'lib/image_diff/differ/results/list.rb', line 15

def initialize
  clear
end

Instance Method Details

#clearObject



19
20
21
# File 'lib/image_diff/differ/results/list.rb', line 19

def clear
  @list = Hash.new { |hash, key| hash[key] = [] }
end

#filter(method) ⇒ Object



23
24
25
26
27
28
# File 'lib/image_diff/differ/results/list.rb', line 23

def filter(method)
  each_with_object({}) do |(component, results), hash|
    selected = Filter.apply(results, method)
    hash[component] = selected unless selected.empty?
  end
end

#reference_errorsObject



30
31
32
# File 'lib/image_diff/differ/results/list.rb', line 30

def reference_errors
  filter(:select)
end

#regressionsObject



34
35
36
# File 'lib/image_diff/differ/results/list.rb', line 34

def regressions
  filter(:reject)
end