Sha256: b19a42c6a90e33ae9867fca840ac1c6e6082d58f9d602973847ff1c1dc67f2ab
Contents?: true
Size: 792 Bytes
Versions: 118
Compression:
Stored size: 792 Bytes
Contents
module Temple module Filters # Merges several statics into a single static. Example: # # [:multi, # [:static, "Hello "], # [:static, "World!"]] # # Compiles to: # # [:static, "Hello World!"] # # @api public class StaticMerger < Filter def on_multi(*exps) result = [:multi] text = nil exps.each do |exp| if exp.first == :static if text text << exp.last else text = exp.last.dup result << [:static, text] end else result << compile(exp) text = nil unless exp.first == :newline end end result.size == 2 ? result[1] : result end end end end
Version data entries
118 entries across 104 versions & 7 rubygems