<commit_before>require 'api/guide'

class GuidesController < ApplicationController
  def show
    publication = Publication.first(conditions: {slug: params[:id]})
    edition = publication.published_edition
    render :json => Api::Generator::Guide.edition_to_hash(edition)
  end
end<commit_msg>Make selection of API Generator module more explicit<commit_after>require 'api/guide'

class GuidesController < ApplicationController
  def show
    publication = Publication.first(conditions: {slug: params[:id]})
    edition = publication.published_edition
    generator = case publication.class
      when Transaction then Api::Generator::Transaction
      when Guide then Api::Generator::Guide
      when Answer then Api::Generator::Guide
    end
            
    render :json => generator.edition_to_hash(edition)
  end
end
{'fraction_non_alphanumeric': 0.0851581508515815, 'fraction_numerical': 0.0, 'mean_word_length': 4.523489932885906, 'pattern_counts': {'":': 0, '<': 5, '<?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': '5508295', 'n_tokens_mistral': 219, 'n_tokens_neox': 221, 'n_words': 58}