Module: Jekyll::SortNatural

Defined in:
lib/jekyll_sort_natural.rb

Instance Method Summary collapse

Instance Method Details

#sort_natural(input) ⇒ Object

Sort a hash using String#casecmp the case-insensitive version of String#<=> Modified from github.com/tkrotoff/osteo15.com/blob/b0c8bf66a75fe8b52ef38d94e5f5e1c9469c1957/_plugins/filters.rb#L13-L18 By default, Enumerable#sort uses <=> See Add sort_natural to jekyll/filters.rb github.com/jekyll/jekyll/issues/6290 This overrides sort_natural provided by Liquid 4 (shopify.github.io/liquid/filters/sort_natural/)



14
15
16
# File 'lib/jekyll_sort_natural.rb', line 14

def sort_natural(input)
  input.sort { |a, b| a.first.casecmp(b.first) }
end