Class: LittleGhost::PromptResolver::RenderContext
- Inherits:
-
Object
- Object
- LittleGhost::PromptResolver::RenderContext
- Defined in:
- lib/little_ghost/prompt_resolver.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(resolver, roots, stack, name, locals, assigns) ⇒ RenderContext
constructor
A new instance of RenderContext.
- #partial(name, locals: {}) ⇒ Object
- #template_binding ⇒ Object
Constructor Details
#initialize(resolver, roots, stack, name, locals, assigns) ⇒ RenderContext
Returns a new instance of RenderContext.
226 227 228 229 230 231 232 233 |
# File 'lib/little_ghost/prompt_resolver.rb', line 226 def initialize(resolver, roots, stack, name, locals, assigns) @_little_ghost_resolver = resolver @_little_ghost_roots = roots @_little_ghost_stack = stack @_little_ghost_name = name @_little_ghost_locals = validate_locals(locals) @_little_ghost_assigns = validate_assigns(assigns) end |
Instance Method Details
#partial(name, locals: {}) ⇒ Object
235 236 237 238 239 240 241 242 243 244 245 |
# File 'lib/little_ghost/prompt_resolver.rb', line 235 def partial(name, locals: {}) @_little_ghost_resolver.send( :render_partial, name, locals, @_little_ghost_assigns, @_little_ghost_roots, @_little_ghost_stack, @_little_ghost_name ) end |
#template_binding ⇒ Object
247 248 249 250 251 252 |
# File 'lib/little_ghost/prompt_resolver.rb', line 247 def template_binding @_little_ghost_assigns.each { |name, value| instance_variable_set("@#{name}", value) } context_binding = binding @_little_ghost_locals.each { |name, value| context_binding.local_variable_set(name, value) } context_binding end |