Module: RtfTemplater::Generator

Defined in:
lib/rtf-templater/generator.rb

Instance Method Summary collapse

Instance Method Details

#dec(string) ⇒ Object



4
5
6
7
# File 'lib/rtf-templater/generator.rb', line 4

def dec string
  out = string.to_s
  out.unpack('U*').map { |n| n < 128 ? n.chr : n < 256 ? "\\'#{n.to_s(16)}" : "\\u#{n}\\'3f" }.join
end

#render_rtf(content) ⇒ Object



9
10
11
12
# File 'lib/rtf-templater/generator.rb', line 9

def render_rtf content
  template = Template.new
  template.process content, binding
end