Sha256: 00f0846a9e46a10abd99691ca7797a0adac804726eeecbf39a3dbc0733d3014f
Contents?: true
Size: 500 Bytes
Versions: 53
Compression:
Stored size: 500 Bytes
Contents
module Temple module Filters # Erase expressions with a certain type # # @api public class Eraser < Filter # [] is the empty type => keep all default_options[:keep] = [[]] 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
53 entries across 53 versions & 2 rubygems