<commit_before>module HighVoltage::StaticPage
  extend ActiveSupport::Concern

  included do
    layout ->(_) { HighVoltage.layout }

    rescue_from ActionView::MissingTemplate do |exception|
      if exception.message =~ %r{Missing template #{page_finder.content_path}}
        invalid_page
      else
        raise exception
      end
    end

    rescue_from HighVoltage::InvalidPageIdError, with: :invalid_page

    hide_action :current_page, :page_finder, :page_finder_factory
  end

  def show
    render template: current_page
  end

  def current_page
    page_finder.find
  end

  def page_finder
    page_finder_factory.new(params[:id])
  end

  def page_finder_factory
    HighVoltage::PageFinder
  end

  def invalid_page
    raise ActionController::RoutingError, "No such page: #{params[:id]}"
  end
end<commit_msg>Remove hide_action as it is not supported in Rails 5<commit_after>module HighVoltage::StaticPage
  extend ActiveSupport::Concern

  included do
    layout ->(_) { HighVoltage.layout }

    rescue_from ActionView::MissingTemplate do |exception|
      if exception.message =~ %r{Missing template #{page_finder.content_path}}
        invalid_page
      else
        raise exception
      end
    end

    rescue_from HighVoltage::InvalidPageIdError, with: :invalid_page
  end

  def show
    render template: current_page
  end

  def invalid_page
    raise ActionController::RoutingError, "No such page: #{params[:id]}"
  end

  private

  def current_page
    page_finder.find
  end

  def page_finder
    page_finder_factory.new(params[:id])
  end

  def page_finder_factory
    HighVoltage::PageFinder
  end
end
{'fraction_non_alphanumeric': 0.07007921998781232, 'fraction_numerical': 0.0006093845216331506, 'mean_word_length': 3.548476454293629, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4258885', 'n_tokens_mistral': 508, 'n_tokens_neox': 493, 'n_words': 125}