Sha256: 8c2588df76a07c882fb5007547c1f9af126d6b1920028b491e969b8545b888e5

Contents?: true

Size: 640 Bytes

Versions: 2

Compression:

Stored size: 640 Bytes

Contents

# ERB templating.
#--
# Copyright 2006-2007 Suraj N. Kurapati
# See the file named LICENSE for details.

require 'erb'

# A version of ERB whose embedding tags behave like those of PHP. That is, only
# <%= ... %> tags produce output, whereas <% ... %> tags do *not* produce any
# output.
class ERB
  alias original_initialize initialize

  def initialize aInput, *aArgs
    # ensure that only <%= ... %> tags generate output
      input = aInput.gsub %r{<%=.*?%>}m do |s|
        if ($' =~ /\r?\n/) == 0
          s << $&
        else
          s
        end
      end

      aArgs[1] = '>'

    original_initialize input, *aArgs
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-vpi-16.0.1 lib/ruby-vpi/erb.rb
ruby-vpi-16.0.0 lib/ruby-vpi/erb.rb