Class: Nitro::EachMorpher

Inherits:
Morpher
  • Object
show all
Defined in:
lib/nitro/compiler/morphing.rb

Overview

attribute: each, for

  • my item is #item
  • becomes

  • my item is #item
  • Instance Method Summary collapse

    Methods inherited from Morpher

    #after_start, #before_end, #initialize

    Constructor Details

    This class inherits a constructor from Nitro::Morpher

    Instance Method Details

    #after_end(buffer) ⇒ Object

    
    
    79
    80
    81
    82
    83
    # File 'lib/nitro/compiler/morphing.rb', line 79
    
    def after_end(buffer)
      if @value =~ / in /
        buffer << " <?r end ?>"
      end
    end

    #before_start(buffer) ⇒ Object

    
    
    72
    73
    74
    75
    76
    77
    # File 'lib/nitro/compiler/morphing.rb', line 72
    
    def before_start(buffer)
      if @value =~ / in /
        buffer << "<?r for #@value ?> "
        @attributes.delete(@key)
      end
    end