Module: Resulang::Rendering

Includes:
ActiveSupport::Inflector
Included in:
Section, Template
Defined in:
lib/resulang/rendering.rb

Instance Method Summary collapse

Instance Method Details

#html_escape(str) ⇒ Object



13
14
15
# File 'lib/resulang/rendering.rb', line 13

def html_escape(str)
  ERB::Util.html_escape(str)
end

#partial(name) ⇒ Object



17
18
19
# File 'lib/resulang/rendering.rb', line 17

def partial(name)
  File.expand_path("../_#{name}.html.erb", template_path)
end

#render_section(section) ⇒ Object



7
8
9
10
11
# File 'lib/resulang/rendering.rb', line 7

def render_section(section)
  if s = sections[section.to_sym]
    ERB.new(File.read(partial(section))).result(s.get_binding)
  end
end