Module: TreeDelta::Sorter

Defined in:
lib/tree_delta/sorter.rb

Class Method Summary collapse

Class Method Details

.sort(array, enumerator) ⇒ Object



2
3
4
5
6
7
8
9
10
11
# File 'lib/tree_delta/sorter.rb', line 2

def self.sort(array, enumerator)
  sorted_array = []

  enumerator.each do |object|
    element = array.detect { |e| e.identity == object.identity }
    sorted_array << element if element
  end

  sorted_array
end