Class: Pancake::Mixins::Render::ViewContext

Inherits:
Object
  • Object
show all
Includes:
Capture, ContentInheritance, Renderer
Defined in:
lib/pancake/mixins/render/render.rb,
lib/pancake/mixins/render/view_context.rb

Defined Under Namespace

Modules: Capture, ContentInheritance, Renderer

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ContentInheritance

#content_block, #inherits_from, #super

Methods included from Renderer

#_current_renderer, #_with_renderer, #partial, #render

Methods included from Capture

#_erb_capture, #_erb_concat, #_haml_capture, #_haml_concat, #capture, #concat

Constructor Details

#initialize(env, renderer_for = nil) ⇒ ViewContext

Returns a new instance of ViewContext.



12
13
14
15
16
# File 'lib/pancake/mixins/render/view_context.rb', line 12

def initialize(env, renderer_for = nil )
  super
  @env = env
  @_view_context_for = renderer_for
end

Instance Attribute Details

#_view_context_forObject (readonly)

Returns the value of attribute _view_context_for.



11
12
13
# File 'lib/pancake/mixins/render/view_context.rb', line 11

def _view_context_for
  @_view_context_for
end

Class Method Details

._capture_methodsObject



10
11
12
# File 'lib/pancake/mixins/render/render.rb', line 10

def _capture_methods
  @_capture_methods ||= {}
end

._concat_methodsObject



6
7
8
# File 'lib/pancake/mixins/render/render.rb', line 6

def _concat_methods
  @_concat_methods ||= {}
end

.capture_method_for(item) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/pancake/mixins/render/render.rb', line 14

def capture_method_for(item)
  key = case item
        when Template
          item.renderer.class
        when Tilt::Template
          item
        end
  _capture_methods[key]
end

.concat_method_for(item) ⇒ Object



24
25
26
27
28
29
30
31
32
# File 'lib/pancake/mixins/render/render.rb', line 24

def concat_method_for(item)
  key = case item
        when Template
          item.renderer.class
        when Tilt::Template
          item
        end
  _concat_methods[key]
end