class ActionView::Template

def compiled_source

frozen string literal.
involves setting strict_locals! if applicable, encoding the template, and setting
This method compiles the source of the template. The compilation of templates
def compiled_source
  set_strict_locals = strict_locals!
  source = encode!
  code = @handler.call(self, source)
  method_arguments =
    if set_strict_locals
      "output_buffer, #{set_strict_locals}"
    else
      "local_assigns, output_buffer"
    end
  # Make sure that the resulting String to be eval'd is in the
  # encoding of the code
  source = +<<-end_src
    def #{method_name}(#{method_arguments})
      @virtual_path = #{@virtual_path.inspect};#{locals_code};#{code}
    end
  end_src
  # Make sure the source is in the encoding of the returned code
  source.force_encoding(code.encoding)
  # In case we get back a String from a handler that is not in
  # BINARY or the default_internal, encode it to the default_internal
  source.encode!
  # Now, validate that the source we got back from the template
  # handler is valid in the default_internal. This is for handlers
  # that handle encoding but screw up
  unless source.valid_encoding?
    raise WrongEncodingError.new(source, Encoding.default_internal)
  end
  if Template.frozen_string_literal
    "# frozen_string_literal: true\n#{source}"
  else
    source
  end
end