Module: OData::AbstractSchema::Comparable

Included in:
SchemaObject
Defined in:
lib/o_data/abstract_schema/comparable.rb

Instance Method Summary collapse

Instance Method Details

#compare(a, b, property_order_pairs = []) ⇒ Object



4
5
6
7
# File 'lib/o_data/abstract_schema/comparable.rb', line 4

def compare(a, b, property_order_pairs = [])
  _pairs = [] + property_order_pairs
  _compare(a, b, _pairs.shift, _pairs)
end

#sort(many, property_order_pairs = []) ⇒ Object



9
10
11
# File 'lib/o_data/abstract_schema/comparable.rb', line 9

def sort(many, property_order_pairs = [])
  [many].compact.flatten.sort { |a, b| compare(a, b, property_order_pairs) }
end