<commit_before>class QuestionPresenter < NodePresenter
  extend Forwardable
  delegate [
    :translate!,
    :translate_and_render,
    :translate_option
  ] => :@renderer

  def initialize(i18n_prefix, node, state = nil, options = {})
    super(i18n_prefix, node, state)
    @renderer = options[:renderer]
    helpers = options[:helpers] || []
    @renderer ||= SmartAnswer::ErbRenderer.new(
      template_directory: @node.template_directory.join('questions'),
      template_name: @node.filesystem_friendly_name,
      locals: @state.to_hash,
      helpers: [SmartAnswer::FormattingHelper] + helpers
    )
  end

  def title
    @renderer.single_line_of_content_for(:title)
  end

  def error
    if @state.error.present?
      error_message_for(@state.error) || error_message_for('error_message') || I18n.translate('flow.defaults.error_message')
    end
  end

  def error_message_for(key)<commit_msg>Avoid delegating to renderer from QuestionPresenter<commit_after>class QuestionPresenter < NodePresenter
  def initialize(i18n_prefix, node, state = nil, options = {})
    super(i18n_prefix, node, state)
    @renderer = options[:renderer]
    helpers = options[:helpers] || []
    @renderer ||= SmartAnswer::ErbRenderer.new(
      template_directory: @node.template_directory.join('questions'),
      template_name: @node.filesystem_friendly_name,
      locals: @state.to_hash,
      helpers: [SmartAnswer::FormattingHelper] + helpers
    )
  end

  def title
    @renderer.single_line_of_content_for(:title)
  end

  def error
    if @state.error.present?
      error_message_for(@state.error) || error_message_for('error_message') || I18n.translate('flow.defaults.error_message')
    end
  end

  def error_message_for(key)
{'fraction_non_alphanumeric': 0.11322934719815136, 'fraction_numerical': 0.006932409012131715, 'mean_word_length': 4.296636085626911, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3381372', 'n_tokens_mistral': 558, 'n_tokens_neox': 548, 'n_words': 97}