Sha256: 9388493adc4cc4fcb7b656b2bf423c416b300fbda680730df89a42261fb41077
Contents?: true
Size: 549 Bytes
Versions: 4
Compression:
Stored size: 549 Bytes
Contents
# frozen_string_literal: true module Commander module Patches module PrioritySort attr_accessor :priority def <=>(other) # Different classes can not be compared and thus are considered # equal in priority return 0 unless self.class == other.class # Sort firstly based on the commands priority comp = (self.priority || 0) <=> (other.priority || 0) # Fall back on name comparison if priority is equal comp == 0 ? self.name <=> other.name : comp end end end end
Version data entries
4 entries across 4 versions & 1 rubygems