Sha256: 7b377d60985f5174e2ba8e2e165a8b3086a6edb34150aba458bfc698d5704195
Contents?: true
Size: 564 Bytes
Versions: 35
Compression:
Stored size: 564 Bytes
Contents
# frozen_string_literal: true module Jekyll module Filters module Compact # Removes nil values from an Array # # Example usage: # # {{ 'tag,,tag2' | split: ',' | compact }} # # @param [Array] # @return [Array] def compact(array) return [] unless array.is_a? Array @cache = Jekyll::Cache.new('Jekyll::Filters::Compact') @cache.getset(array.hash.to_s) do array.compact end end end end end Liquid::Template.register_filter(Jekyll::Filters::Compact)
Version data entries
35 entries across 35 versions & 1 rubygems