Use Filters#item_property to fetch the property to sort by. #2340

Closed
wants to merge 1 commit into from

2 participants

@parkr
Jekyll member

Fixes #2328

/cc @penibelst since you were the one to last update this sort filter

@penibelst
Jekyll member

Haha, I have a similar solution borrowed from the original filter:

def hash_property(hash, property)
  if hash.respond_to?('[]'.freeze)
    hash[property]
  elsif hash.respond_to?(property)
    hash.send(property)
  else
    nil
  end
end

I’m figuring out how to test collections. I’ve never use them.

@parkr parkr added this to the 2.0.3 milestone May 7, 2014
@penibelst penibelst referenced this pull request May 7, 2014
Merged

Sort collections #2345

@penibelst
Jekyll member

Can be closed too.

@parkr parkr closed this May 10, 2014
@parkr parkr deleted the use-item-prop branch May 10, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment