Method: Osm::Section#<=>
- Defined in:
- lib/osm/section.rb
#<=>(another) ⇒ Object
Compare Section based on group_name type (age order), then name
380 381 382 383 384 385 386 387 388 |
# File 'lib/osm/section.rb', line 380 def <=>(another) type_order = [:beavers, :cubs, :scouts, :explorers, :network, :adults, :waiting] result = self.group_name <=> another.try(:group_name) if result == 0 result = type_order.find_index(self.type) <=> type_order.find_index(another.try(:type)) end result = self.name <=> another.try(:name) if result == 0 return result end |