Class: Synvert::Core::Engine::ERB

Inherits:
Object
  • Object
show all
Defined in:
lib/synvert/core/engine/erb.rb

Class Method Summary collapse

Class Method Details

.decode(source) ⇒ String

convert ruby code to erb.

Parameters:

  • source (String)

    ruby source code.

Returns:

  • (String)

    erb source code.


23
24
25
26
27
28
# File 'lib/synvert/core/engine/erb.rb', line 23

def decode(source)
  source = decode_ruby_stmt(source)
  source = decode_ruby_output(source)
  source = decode_html_output(source)
  source = remove_erubis_buf(source)
end

.encode(source) ⇒ String

convert erb to ruby code.

Parameters:

  • source (String)

    erb source code.

Returns:

  • (String)

    ruby source code.


15
16
17
# File 'lib/synvert/core/engine/erb.rb', line 15

def encode(source)
  Erubis.new(source.gsub("-%>", "%>"), :escape => false, :trim => false).src
end