Sha256: 35a71de6d595f539d5f40c78dfd15de89e2f850539d24fa7ef2008a36700ba4a

Contents?: true

Size: 396 Bytes

Versions: 1

Compression:

Stored size: 396 Bytes

Contents

require 'liquid'

module Jekyll
  module IsNIl
    def isnil(val, default)
      if [true, false].include? val
        return val
      end
        
      if val == nil
        return default
      end
    
      if val.is_a? String and val.strip == ''
        return default
      end
    
      return val
    end
  end
end

Liquid::Template.register_filter(Jekyll::IfNIl)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fenton-jekyll-plugin-0.0.12 lib/fenton-jekyll-plugin/jb_liquid_isnil.rb