Sha256: df26ea5763240387fd0dd56b20dce8ccc056c73c3032a8cc7b10086497184fcf
Contents?: true
Size: 536 Bytes
Versions: 3
Compression:
Stored size: 536 Bytes
Contents
# frozen_string_literal: true module Synvert::Core module Engine class Erb class << self # Encode erb string, leave only ruby code, replace other erb code with whitespace. # # @param source [String] erb code. # @return [String] encoded ruby code. def encode(source) source.gsub(/%>.*?<%=?/m) { |str| ' ' * str.size } .sub(/^.*?<%=?/m) { |str| ' ' * str.size } .sub(/%>.*?$/m) { |str| ' ' * str.size } end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
synvert-core-1.22.1 | lib/synvert/core/engine/erb.rb |
synvert-core-1.22.0 | lib/synvert/core/engine/erb.rb |
synvert-core-1.21.7 | lib/synvert/core/engine/erb.rb |