Sha256: d48479e9b4c1d3e8d5375443735a445eee564698450903f037bc20e9d85117ac

Contents?: true

Size: 550 Bytes

Versions: 7

Compression:

Stored size: 550 Bytes

Contents

module Temple
  module Generators
    # Implements an ERB generator.
    #
    # @api public
    class ERB < Generator
      def call(exp)
        compile(exp)
      end

      def on_multi(*exp)
        exp.map {|e| compile(e) }.join
      end

      def on_capture(name, exp)
        on_code(super)
      end

      def on_static(text)
        text
      end

      def on_newline
        "<%\n%>"
      end

      def on_dynamic(code)
        "<%= #{code} %>"
      end

      def on_code(code)
        "<% #{code} %>"
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
temple-0.7.1 lib/temple/generators/erb.rb
temple-0.6.10 lib/temple/generators/erb.rb
temple-0.6.9 lib/temple/generators/erb.rb
temple-0.6.8 lib/temple/generators/erb.rb
temple-0.6.7 lib/temple/generators/erb.rb
temple-0.6.6 lib/temple/generators/erb.rb
temple-0.6.5 lib/temple/generators/erb.rb