<commit_before>class Tower::Service
  
  ## Takes
  # setup args for runners
  def self.takes(*names)
    return @takes if names.empty?
    @takes = names
  end
  
  ## Runners
  
  # run service now
  def self.now(*args)
    new(*args).run
  end
  
  def self.later(*args)
    Tower::Queue.add self, *args
  end
  

  ## Initialize
  # takes any number of args which are set as instance variables
  def initialize(*args)
    set_instance_variables args
  end
  
  
  ## Run
  # called by Service.now after initializing new service
  # override with service logic
  def run; raise NotImplementedError; end
  
  private

  
  ## Instance Variables
  # args passed to runners saved as instance variables
  
  # @params[values] args array from #initialize
  # creates an instance variable for each arg passed to initialize
  # variable names pulled from self.class.args
  def set_instance_variables(values)
    values.each_with_index do |value,i|<commit_msg>added :perform alias so Delayed::Job can run services<commit_after>class Tower::Service
  
  ## Takes
  # setup args for runners
  def self.takes(*names)
    return @takes if names.empty?
    @takes = names
  end
  
  ## Runners
  
  # run service now
  def self.now(*args)
    new(*args).run
  end
  
  def self.later(*args)
    Tower::Queue.add self, *args
  end
  

  ## Initialize
  # takes any number of args which are set as instance variables
  def initialize(*args)
    set_instance_variables args
  end
  
  
  ## Run
  # called by Service.now after initializing new service
  # override with service logic
  def run; raise NotImplementedError; end
  alias :perform :run
  
  private

  
  ## Instance Variables
  # args passed to runners saved as instance variables
  
  # @params[values] args array from #initialize
  # creates an instance variable for each arg passed to initialize
  # variable names pulled from self.class.args
  def set_instance_variables(values)
    values.each_with_index do |value,i|
{'fraction_non_alphanumeric': 0.07150101419878296, 'fraction_numerical': 0.0, 'mean_word_length': 3.171247357293869, 'pattern_counts': {'":': 0, '<': 3, '<?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': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3907823', 'n_tokens_mistral': 600, 'n_tokens_neox': 587, 'n_words': 209}