<commit_before>module Embeddable
  class OpenResponse < ActiveRecord::Base
    include Embeddable
    

    attr_accessible :name, :prompt, :is_prediction, :give_prediction_feedback, :prediction_feedback

    # PageItem instances are join models, so if the embeddable is gone the join should go too.
    has_many :page_items, :as => :embeddable, :dependent => :destroy
    has_many :interactive_pages, :through => :page_items
    has_many :answers,
      :class_name  => 'Embeddable::OpenResponseAnswer',
      :foreign_key => 'open_response_id'

    default_value_for :prompt, "why does ..."

    def to_hash
      {
        name: name,
        prompt: prompt,
        is_prediction: is_prediction,
        give_prediction_feedback: give_prediction_feedback,
        prediction_feedback: prediction_feedback
      }
    end

    def duplicate
      return Embeddable::OpenResponse.new(self.to_hash)
    end

    def self.name_as_param
      :embeddable_open_response
    end

    def self.display_partial
      :open_response
    end

    def self.human_description
      "Multiple choice question"
    end
    
    def export
      return self.as_json(only:[:name,
                                :prompt,
                                :is_prediction,
                                :give_prediction_feedback,
                                :prediction_feedback])
    end
    
    def self.import (import_hash)
      return self.new(import_hash)
    end
    include CRater::SettingsProviderFunctionality
  end
end
<commit_msg>Add comment for include module after function definitions.<commit_after>module Embeddable
  class OpenResponse < ActiveRecord::Base
    include Embeddable
    

    attr_accessible :name, :prompt, :is_prediction, :give_prediction_feedback, :prediction_feedback

    # PageItem instances are join models, so if the embeddable is gone the join should go too.
    has_many :page_items, :as => :embeddable, :dependent => :destroy
    has_many :interactive_pages, :through => :page_items
    has_many :answers,
      :class_name  => 'Embeddable::OpenResponseAnswer',
      :foreign_key => 'open_response_id'

    default_value_for :prompt, "why does ..."

    def to_hash
      {
        name: name,
        prompt: prompt,
        is_prediction: is_prediction,
        give_prediction_feedback: give_prediction_feedback,
        prediction_feedback: prediction_feedback
      }
    end

    def duplicate
      return Embeddable::OpenResponse.new(self.to_hash)
    end

    def self.name_as_param
      :embeddable_open_response
    end

    def self.display_partial
      :open_response
    end

    def self.human_description
      "Multiple choice question"
    end
    
    def export
      return self.as_json(only:[:name,
                                :prompt,
                                :is_prediction,
                                :give_prediction_feedback,
                                :prediction_feedback])
    end
    
    def self.import (import_hash)
      return self.new(import_hash)
    end

    # SettingsProviderFunctionality extends the functionality of duplicate, export and import using alias_method_chain. So these methods needs to be visible to the SettingsProviderFunctionality.
    include CRater::SettingsProviderFunctionality
  end
end

{'fraction_non_alphanumeric': 0.06444780635400908, 'fraction_numerical': 0.0, 'mean_word_length': 2.4082474226804123, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '3614730', 'n_tokens_mistral': 968, 'n_tokens_neox': 906, 'n_words': 228}