class Yokunai::RenderContext
Provides a clean binding and basic API to add variables to it. Meant to be used only for template rendering.
Public Class Methods
new(context = {})
click to toggle source
Instantiate a new instance and create local variables for the key/value pairs in the given hash.
@param context [Hash] variables to set on the local binding @return [Yokunai::RenderContext]
# File lib/yokunai/render_context.rb, line 11 def initialize(context = {}) @binding = binding context.each do |key, value| @binding.local_variable_set(key, value) end end
Public Instance Methods
get_binding()
click to toggle source
Returns the binding of this class, with the variables that have been set.
# File lib/yokunai/render_context.rb, line 20 def get_binding @binding end
method_missing(m, *args, &block)
click to toggle source
Sort of a hack, since if a var doesn't exist it will try and call a method and so we'll end up hereā¦
# File lib/yokunai/render_context.rb, line 26 def method_missing(m, *args, &block) nil end