Class: Raw::EachMorpher

Inherits:
Morpher show all
Defined in:
lib/raw/compiler/filter/morph/each.rb

Overview

attribute: each, for

  • my item is #item
  • becomes

  • my item is #item
  • Direct Known Subclasses

    ForMorpher

    Instance Attribute Summary

    Attributes inherited from Morpher

    #attributes, #key, #name, #value

    Class Method Summary collapse

    Instance Method Summary collapse

    Methods inherited from Morpher

    #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/each.rb', line 16
    
    def self.key
      "each"
    end

    Instance Method Details

    #after_end(buffer) ⇒ Object

    
    
    27
    28
    29
    30
    31
    # File 'lib/raw/compiler/filter/morph/each.rb', line 27
    
    def after_end(buffer)
      if @value =~ / in /
        buffer << " <?r end ?>"
      end
    end

    #before_start(buffer) ⇒ Object

    
    
    20
    21
    22
    23
    24
    25
    # File 'lib/raw/compiler/filter/morph/each.rb', line 20
    
    def before_start(buffer)
      if @value =~ / in /
        buffer << "<?r for #@value ?> "
        attributes.delete(@key)
      end
    end