Module: ActionView::Renderable

Extended by:
ActiveSupport::Memoizable
Included in:
InlineTemplate, Template
Defined in:
lib/action_view/renderable.rb,
lib/action_view/test_case.rb

Overview

NOTE: The template that this mixin is being included into is frozen so you cannot set or modify any instance variables

Instance Method Summary collapse

Instance Method Details

#compiled_sourceObject



18
19
20
# File 'lib/action_view/renderable.rb', line 18

def compiled_source
  handler.call(self)
end

#filenameObject



9
10
11
# File 'lib/action_view/renderable.rb', line 9

def filename
  'compiled-template'
end

#handlerObject



13
14
15
# File 'lib/action_view/renderable.rb', line 13

def handler
  Template.handler_class_for_extension(extension)
end

#method_name(local_assigns) ⇒ Object



45
46
47
48
49
50
51
52
53
# File 'lib/action_view/renderable.rb', line 45

def method_name(local_assigns)
  if local_assigns && local_assigns.any?
    method_name = method_name_without_locals.dup
    method_name << "_locals_#{local_assigns.keys.map { |k| k.to_s }.sort.join('_')}"
  else
    method_name = method_name_without_locals
  end
  method_name.to_sym
end

#method_name_without_localsObject



22
23
24
# File 'lib/action_view/renderable.rb', line 22

def method_name_without_locals
  ['_run', extension, method_segment].compact.join('_')
end

#render(view, local_assigns = {}) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/action_view/test_case.rb', line 14

def render(view, local_assigns = {})
  if respond_to?(:path) && !is_a?(InlineTemplate)
    rendered = view.instance_variable_get(:@_rendered)
    rendered[:partials][self] += 1 if is_a?(RenderablePartial)
    rendered[:template] ||= self
  end
  render_without_template_tracking(view, local_assigns)
end

#render_without_template_trackingObject



13
# File 'lib/action_view/test_case.rb', line 13

alias_method :render_without_template_tracking, :render