Sha256: 06364b9eb58974f450d9fd0703fd6b175ab264f0b9f14e87893e1dca620b9101
Contents?: true
Size: 514 Bytes
Versions: 11
Compression:
Stored size: 514 Bytes
Contents
module Temple module Filters # Erase expressions with a certain type # # @api public class Eraser < Filter # [] is the empty type => keep all define_options :keep => [[]], :erase => nil def compile(exp) exp.first == :multi || (do?(:keep, exp) && !do?(:erase, exp)) ? super(exp) : [:multi] end protected def do?(list, exp) options[list].to_a.map {|type| [*type] }.any? {|type| exp[0,type.size] == type } end end end end
Version data entries
11 entries across 11 versions & 1 rubygems