<commit_before>class ApplicationAction < ActiveRecord::Base

  include Engines::Api

  attr_accessor :application, :name, :command, :return_type, :return_file_name, :label, :description, :action_result, :engines_api_error, :log

  has_many :variables, as: :variable_consumer, dependent: :destroy
  accepts_nested_attributes_for :variables

  def load
    assign_attributes(application.actionator_params_for name)
    self
  end

  def perform_action
    result = engines_api.perform_engine_action(application.container_name, name, update_application_action_variables_params)
    if result.is_a? EnginesOSapiResult
      @engines_api_error = "Unable perform action. " +
                            (result.result_mesg.present? ? result.result_mesg : "Called 'perform_application_action'. No result message given by engines api.")
      false
    else
      @action_result = result
      true
    end
  end

  def new_record?
    true
  end

  def perform_application_action_params
    { application_name: application.container_name, actionator_name: name, variables: update_application_action_variables_params }
  end

  def update_application_action_variables_params<commit_msg>added script accessor to application action class<commit_after>class ApplicationAction < ActiveRecord::Base

  include Engines::Api

  attr_accessor :application, :name, :command, :return_type, :return_file_name, :label, :description, :action_result, :engines_api_error, :log, :script

  has_many :variables, as: :variable_consumer, dependent: :destroy
  accepts_nested_attributes_for :variables

  def load
    assign_attributes(application.actionator_params_for name)
    self
  end

  def perform_action
    result = engines_api.perform_engine_action(application.container_name, name, update_application_action_variables_params)
    if result.is_a? EnginesOSapiResult
      @engines_api_error = "Unable perform action. " +
                            (result.result_mesg.present? ? result.result_mesg : "Called 'perform_application_action'. No result message given by engines api.")
      false
    else
      @action_result = result
      true
    end
  end

  def new_record?
    true
  end

  def perform_application_action_params
    { application_name: application.container_name, actionator_name: name, variables: update_application_action_variables_params }
  end

  def update_application_action_variables_params
{'fraction_non_alphanumeric': 0.06580591420241566, 'fraction_numerical': 0.0, 'mean_word_length': 4.509174311926605, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '4489976', 'n_tokens_mistral': 683, 'n_tokens_neox': 668, 'n_words': 158}