Module: Jekyll::Jekyll316Where

Defined in:
jekyll/_plugins/jekyll-3.1.6-where.rb

Instance Method Summary collapse

Instance Method Details

#where(input, property, value) ⇒ Object

Filter an array of objects

input - the object array property - property within each object to filter by value - desired value

Returns the filtered array of objects



11
12
13
14
15
16
# File 'jekyll/_plugins/jekyll-3.1.6-where.rb', line 11

def where(input, property, value)
  return input unless input.is_a?(Enumerable)
  input = input.values if input.is_a?(Hash)
  input.select { |object| item_property(object, property).to_s == value.to_s }

end