vendor/laravel-frontend-presets/argon/src/argon-stubs/resources/assets/vendor/jekyll/lib/jekyll/filters.rb
# Sort an array of objects
#
# input - the object array
# property - property within each object to filter by
# nils ('first' | 'last') - nils appear before or after non-nil values
#
# Returns the filtered array of objects
Sort an array of objects
input - the object array
property - property within each object to filter by
nils ('first' | 'last') - nils appear before or after non-nil values

Returns the filtered array of objects
Sort an array of objects input - the object array property - property within each object to filter by nils ( ' first ' | ' last ' ) - nils appear before or after non - nil values Returns the filtered array of objects
def sort(input, property = nil, nils = "first")
      if property.nil?
        input.sort
      else
        case
        when nils == "first"
          order = - 1
        when nils == "last"
          order = + 1
        else
          raise ArgumentError.new("Invalid nils order: " +
            "'#{nils}' is not a valid nils order. It must be 'first' or 'last'.")
        end
        input.sort { |apple, orange|
          apple_property = item_property(apple, property)
          orange_property = item_property(orange, property)
          if !apple_property.nil? && orange_property.nil?
            - order
          elsif apple_property.nil? && !orange_property.nil?
            + order
          else
            apple_property <=> orange_property
          end
        }
      end
    end
def sort ( input , property = nil , nils = "first" ) if property . nil? input . sort else case when nils == "first" order = - 1 when nils == "last" order = + 1 else raise ArgumentError . new ( "Invalid nils order: " + "'#{nils}' is not a valid nils order. It must be 'first' or 'last'." ) end input . sort { | apple , orange | apple_property = item_property ( apple , property ) orange_property = item_property ( orange , property ) if ! apple_property . nil? && orange_property . nil? - order elsif apple_property . nil? && ! orange_property . nil? + order else apple_property <=> orange_property end } end end
Sort an array of objects
input - the object array
property - property within each object to filter by
nils ('first' | 'last') - nils appear before or after non-nil values
Sort an array of objects input - the object array property - property within each object to filter by nils ( ' first ' | ' last ' ) - nils appear before or after non - nil values
input
<not_specific>
property
<not_specific>
nils
<not_specific>