class KY::Template
Public Class Methods
new(configuration)
click to toggle source
# File lib/ky/template.rb, line 4 def initialize(configuration) define_methods_from_config(configuration) end
Public Instance Methods
context(context_hash)
click to toggle source
# File lib/ky/template.rb, line 14 def context(context_hash) template_context = binding context_hash.each do |var, value| template_context.local_variable_set(var, value) end template_context end
define_methods_from_config(config)
click to toggle source
# File lib/ky/template.rb, line 8 def define_methods_from_config(config) config.keys.each do |key| define_singleton_method(key) { config[key] } end end