module Kwipper::RendersViews

Constants

VIEWS_PATH
VIEW_EXT

Public Instance Methods

render(view, vars = {}) click to toggle source
# File lib/kwipper/renders_views.rb, line 6
def render(view, vars = {})
  template = File.read file_path_of_view(view)
  vars.each { |name, val| instance_variable_set "@#{name}", val }
  ERB.new(template).result binding
end

Private Instance Methods

file_path_of_view(view) click to toggle source
# File lib/kwipper/renders_views.rb, line 14
def file_path_of_view(view)
  File.join Kwipper::ROOT, VIEWS_PATH, view.to_s + VIEW_EXT
end