Class: Fumbler::Filter
- Inherits:
-
Temple::Filter
- Object
- Temple::Filter
- Fumbler::Filter
- Defined in:
- lib/fumbler/filter.rb
Overview
We just take our array and turn it into something Temple understands
We prefix any calls with fumble_ which will be defined in our context class, and any children
Instance Method Summary collapse
-
#ev(s) ⇒ Object
Create evaluating string.
- #on_multi(*exps) ⇒ Object
Instance Method Details
#ev(s) ⇒ Object
Create evaluating string
41 42 43 |
# File 'lib/fumbler/filter.rb', line 41 def ev(s) "#\{#{s}}" end |
#on_multi(*exps) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/fumbler/filter.rb', line 11 def on_multi(*exps) exps.each_with_index do |exp,i| name = exp[1] case exp[0].to_sym when :dynamic exps[i] = [:dynamic,"fumble_#{name}"] when :block if exp[1] == "end" #just strip any attributes and double up end tags to match block exps[i] = [:block,"end;end"] else exps[i]=[:static,"block"] # TODO - attributes, first we need to fix the parser to grab the whole attribute including quotes, also allow fumble_*params atr = exp[2..-1] # TODO - handle Arrays - think we just need to add it and also end;end above? or inject :multi exps[i]= [:block,<<-code] c = #{name} c = [c] unless c.is_a?(Array) c.each do |b| b.fumble(self) do code end end end return [:multi, *exps] end |