Class: Comparator::CompareArray

Inherits:
Object
  • Object
show all
Defined in:
lib/comparator/array.rb

Defined Under Namespace

Classes: ArrayInitializeError

Instance Method Summary collapse

Instance Method Details

#array_comparator(*args) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/comparator/array.rb', line 14

def array_comparator(*args)
  if args.length > 1
    difference_hash = {}
    evaluation_array = args[0..-2].flatten
    compare_array = args.last.flatten
    difference_hash["difference"] = evaluation_array.difference(compare_array)
  else
    raise ArrayInitializeError
  end
  difference_hash
end

#does_it_work?Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/comparator/array.rb', line 10

def does_it_work?
  true
end