Sha256: 144d1b6f0fa9a87e98aedd597b26169eb83d247929f665f55ee7ed845817ebb8

Contents?: true

Size: 535 Bytes

Versions: 8

Compression:

Stored size: 535 Bytes

Contents

# frozen_string_literal: true
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_dynamic(code)
        "<%= #{code} %>"
      end

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

Version data entries

8 entries across 8 versions & 2 rubygems

Version Path
brakeman-7.0.0 bundle/ruby/3.1.0/gems/temple-0.10.3/lib/temple/generators/erb.rb
brakeman-6.2.2 bundle/ruby/3.1.0/gems/temple-0.10.3/lib/temple/generators/erb.rb
brakeman-6.2.2.rc1 bundle/ruby/3.3.0/gems/temple-0.10.3/lib/temple/generators/erb.rb
brakeman-6.2.1 bundle/ruby/3.1.0/gems/temple-0.10.3/lib/temple/generators/erb.rb
brakeman-6.2.0 bundle/ruby/3.1.0/gems/temple-0.10.3/lib/temple/generators/erb.rb
temple-0.10.3 lib/temple/generators/erb.rb
temple-0.10.2 lib/temple/generators/erb.rb
temple-0.10.1 lib/temple/generators/erb.rb