Class: Synvert::Core::Engine::Erb
- Inherits:
-
Object
- Object
- Synvert::Core::Engine::Erb
- Defined in:
- lib/synvert/core/engine/erb.rb
Class Method Summary collapse
-
.encode(source) ⇒ String
Encode erb string, leave only ruby code, replace other erb code with whitespace.
-
.generate_transform_proc(_encoded_source) ⇒ Object
Generate an empty proc.
Class Method Details
.encode(source) ⇒ String
Encode erb string, leave only ruby code, replace other erb code with whitespace.
11 12 13 14 15 |
# File 'lib/synvert/core/engine/erb.rb', line 11 def encode(source) source.gsub(/%>.*?<%=?/m) { |str| ';' + replace_all_code_but_white_space_characters(str[1..-1]) } .sub(/^.*<%=?/m) { |str| replace_all_code_but_white_space_characters(str) } .sub(/%>.*$/m) { |str| ';' + replace_all_code_but_white_space_characters(str[1..-1]) } end |
.generate_transform_proc(_encoded_source) ⇒ Object
Generate an empty proc.
18 19 20 |
# File 'lib/synvert/core/engine/erb.rb', line 18 def generate_transform_proc(_encoded_source) proc {} end |