Sha256: d9de079e8b8b3b559f76ea215f98df6005da6c2b17975da7d26134d9b4e3bded

Contents?: true

Size: 547 Bytes

Versions: 170

Compression:

Stored size: 547 Bytes

Contents

module Temple
  module Filters
    # Flattens nested multi expressions
    #
    # @api public
    class MultiFlattener < Filter
      def on_multi(*exps)
        # If the multi contains a single element, just return the element
        return compile(exps.first) if exps.size == 1
        result = [:multi]

        exps.each do |exp|
          exp = compile(exp)
          if exp.first == :multi
            result.concat(exp[1..-1])
          else
            result << exp
          end
        end

        result
      end
    end
  end
end

Version data entries

170 entries across 156 versions & 8 rubygems

Version Path
cm-admin-1.5.22 vendor/bundle/ruby/3.3.0/gems/temple-0.8.2/lib/temple/filters/multi_flattener.rb
cm-admin-1.5.21 vendor/bundle/ruby/3.3.0/gems/temple-0.8.2/lib/temple/filters/multi_flattener.rb
cm-admin-1.5.20 vendor/bundle/ruby/3.3.0/gems/temple-0.8.2/lib/temple/filters/multi_flattener.rb
brakeman-6.1.2 bundle/ruby/3.3.0/gems/temple-0.8.2/lib/temple/filters/multi_flattener.rb
brakeman-6.1.1 bundle/ruby/3.0.0/gems/temple-0.8.2/lib/temple/filters/multi_flattener.rb
brakeman-6.1.0 bundle/ruby/3.1.0/gems/temple-0.8.2/lib/temple/filters/multi_flattener.rb
scrapbook-0.3.2 vendor/ruby/2.7.0/gems/temple-0.8.2/lib/temple/filters/multi_flattener.rb
brakeman-6.0.1 bundle/ruby/3.1.0/gems/temple-0.8.2/lib/temple/filters/multi_flattener.rb
scrapbook-0.3.1 vendor/ruby/2.7.0/gems/temple-0.8.2/lib/temple/filters/multi_flattener.rb
brakeman-6.0.0 bundle/ruby/3.0.0/gems/temple-0.8.2/lib/temple/filters/multi_flattener.rb
brakeman-5.4.1 bundle/ruby/3.1.0/gems/temple-0.8.2/lib/temple/filters/multi_flattener.rb
temple-0.10.0 lib/temple/filters/multi_flattener.rb
brakeman-5.4.0 bundle/ruby/2.7.0/gems/temple-0.8.2/lib/temple/filters/multi_flattener.rb
temple-0.9.1 lib/temple/filters/multi_flattener.rb
temple-0.9.0 lib/temple/filters/multi_flattener.rb
brakeman-5.3.1 bundle/ruby/2.7.0/gems/temple-0.8.2/lib/temple/filters/multi_flattener.rb
brakeman-5.3.0 bundle/ruby/2.7.0/gems/temple-0.8.2/lib/temple/filters/multi_flattener.rb
brakeman-5.2.3 bundle/ruby/2.7.0/gems/temple-0.8.2/lib/temple/filters/multi_flattener.rb
brakeman-5.2.2 bundle/ruby/2.7.0/gems/temple-0.8.2/lib/temple/filters/multi_flattener.rb
brakeman-5.2.1 bundle/ruby/2.7.0/gems/temple-0.8.2/lib/temple/filters/multi_flattener.rb