module Contribute::ExtendedSort

Constants

SORT_OPTIONS

Public Instance Methods

error_msg() click to toggle source
# File lib/contribute/extended_sort.rb, line 12
def error_msg
  "sort field argument is not valid. Valid inputs: #{SORT_OPTIONS.join(', ')}"
end
sort_by!(repos, field) click to toggle source
# File lib/contribute/extended_sort.rb, line 7
def sort_by!(repos, field)
  raise error_msg unless SORT_OPTIONS.include? field
  repos.sort! { |a, b| a.send(field) <=> b.send(field) }
end