Class: Nitro::TimesMorpher

Inherits:
StandardMorpher show all
Defined in:
lib/nitro/compiler/morphing.rb

Overview

attribute: times

<li times=“3”>…</li>

becomes

<?r 3.times do ?>

<li>...</li>

<?r end ?>

Instance Method Summary collapse

Methods inherited from StandardMorpher

#after_end

Methods inherited from Morpher

#after_end, #after_start, #before_end, #initialize

Constructor Details

This class inherits a constructor from Nitro::Morpher

Instance Method Details

#before_start(buffer) ⇒ Object



54
55
56
57
58
# File 'lib/nitro/compiler/morphing.rb', line 54

def before_start(buffer)
  # gmosx: leave the trailing space.
  buffer << "<?r #@value.times do ?> "
  @attributes.delete(@key)
end