Class: Raw::IfMorpher
- Inherits:
-
StandardMorpher
- Object
- Morpher
- StandardMorpher
- Raw::IfMorpher
- Defined in:
- lib/raw/compiler/filter/morph/if.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 Attribute Summary
Attributes inherited from Morpher
#attributes, #key, #name, #value
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from StandardMorpher
Methods inherited from Morpher
#after_end, #after_start, #before_end, #initialize
Constructor Details
This class inherits a constructor from Raw::Morpher
Class Method Details
.key ⇒ Object
16 17 18 |
# File 'lib/raw/compiler/filter/morph/if.rb', line 16 def self.key "each" end |
Instance Method Details
#before_start(buffer) ⇒ Object
20 21 22 23 |
# File 'lib/raw/compiler/filter/morph/if.rb', line 20 def before_start(buffer) buffer << "<?r #@key #@value ?> " @attributes.delete(@key) end |