class EasyForm::Template

Public Class Methods

cache(name) { || ... } click to toggle source
# File lib/easy_form/template.rb, line 9
def cache(name)
  store[name] ||= yield
end
render(template_name, binding) click to toggle source
# File lib/easy_form/template.rb, line 13
def render(template_name, binding)
  template = cache template_name do
    File.read [Rails.root, '/app/views/easy_form/_', template_name, '.html.erb'].join
  end
  ERB.new(template).result(binding).html_safe
end
store() click to toggle source
# File lib/easy_form/template.rb, line 4
def store
  return {} if Rails.env.development?
  @store ||= {}
end