Class: Serenity::OdtEruby

Inherits:
Object
  • Object
show all
Includes:
Debug
Defined in:
lib/serenity/odteruby.rb

Constant Summary collapse

EMBEDDED_PATTERN =
/\{%([=%]+)?(.*?)-?%\}/m

Instance Method Summary collapse

Methods included from Debug

#debug?, #debug_dir, #debug_file_name, #debug_file_path

Constructor Details

#initialize(template) ⇒ OdtEruby

Returns a new instance of OdtEruby.



7
8
9
10
11
12
13
14
# File 'lib/serenity/odteruby.rb', line 7

def initialize template
  @src = convert template
  if debug?
    File.open(debug_file_path, 'w') do |f|
      f << @src
    end
  end
end

Instance Method Details

#evaluate(context) ⇒ Object



16
17
18
19
# File 'lib/serenity/odteruby.rb', line 16

def evaluate context
  @src = @src.force_encoding Encoding.default_external
  eval(@src, context)
end