Class: Raw::TimesMorpher

Inherits:
StandardMorpher show all
Defined in:
lib/raw/compiler/filter/morph/times.rb

Overview

attribute: times

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

becomes

<?r 3.times do ?>

<li>...</li>

<?r end ?>

Instance Attribute Summary

Attributes inherited from Morpher

#attributes, #key, #name, #value

Class Method Summary collapse

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 Raw::Morpher

Class Method Details

.keyObject



16
17
18
# File 'lib/raw/compiler/filter/morph/times.rb', line 16

def self.key
  "times"
end

Instance Method Details

#before_start(buffer) ⇒ Object



20
21
22
23
24
# File 'lib/raw/compiler/filter/morph/times.rb', line 20

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