Class: Nitro::IfMorpher

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

Overview

attribute: if, unless

<div prop1=“one” if=“@mycond” prop2=“two”>@mycond is true</div>

becomes

<?r if @mycond ?>

<div prop1="one" prop2="two">@mycond is true</div>

<?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



97
98
99
100
# File 'lib/nitro/compiler/morphing.rb', line 97

def before_start(buffer)
  buffer << "<?r #@key #@value ?> "
  @attributes.delete(@key)
end