Class: Temple::Filters::MultiFlattener
- Inherits:
-
Temple::Filter
- Object
- Temple::Filter
- Temple::Filters::MultiFlattener
- Defined in:
- lib/temple/filters/multi_flattener.rb
Overview
Flattens nested multi expressions
Constant Summary
Constant Summary
Constants included from Utils
Instance Attribute Summary
Attributes included from Mixins::Options
Instance Method Summary (collapse)
Methods included from Mixins::Options
Methods included from Mixins::ControlFlowDispatcher
#on_block, #on_case, #on_cond, #on_if
Methods included from Mixins::EscapeDispatcher
Methods included from Mixins::CoreDispatcher
Methods included from Mixins::CompiledDispatcher
Methods included from Utils
#empty_exp?, #escape_html, #escape_html_safe, #unique_name
Instance Method Details
- (Object) on_multi(*exps)
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/temple/filters/multi_flattener.rb', line 7 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 |