Module: HappyHelpers::Templates

Defined in:
lib/happy-helpers/templates.rb

Class Method Summary collapse

Class Method Details

.load(name) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/happy-helpers/templates.rb', line 9

def self.load(name)
  if false # Freddie.env.production?
    @templates ||= {}
    @templates[name] ||= Tilt.new(name, default_encoding: 'utf-8')
  else
    Tilt.new(name, default_encoding: 'utf-8')
  end
end

.render(name, scope = nil, variables = {}, &block) ⇒ Object



5
6
7
# File 'lib/happy-helpers/templates.rb', line 5

def self.render(name, scope = nil, variables = {}, &block)
  load("views/%s" % name).render(scope, variables, &block)
end