<commit_before>class String
  def underscore
    self.gsub(/::/, '/').
    gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
    gsub(/([a-z\d])([A-Z])/,'\1_\2').
    tr("-", "_").
    tr(" ", "_").
    downcase
  end
end

class Test2
  def self.my_hash
   {
  "apk" => "file",
  "apktool" => "file",
  "output directory" => "dir",
  "dex2jar" => "file"
  }
  end
  
  def self.run
 	 my_hash.each do |k,v|
  		puts "Please specify the absolute location of the #{k}"
  		instance_variable_set("@#{k}".underscore, gets.chomp)
		unless self.exists(v,k)
			redo
		end
 	 end
 	 rescue ::Interrupt
 	 	puts "\nGoodbye"
  end
    
  def self.exists(data_type, entity)  
  	val = instance_variable_get ("@#{entity}".underscore)
  	case data_type
  	when "dir"
  		Dir.exists?(val)
  	when "file"
  		File.exists?(val)
  	end 
  end
  
    
=begin def self.run
  puts "Please specify the path of the APK file: "
  apk_location = gets.chomp
  puts "Please specify the path of the Dex2Jar executable: "
  dex2jar_location = gets.chomp<commit_msg>added some code to make sure that instance variables can be called<commit_after>class String
  def underscore
    self.gsub(/::/, '/').
    gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
    gsub(/([a-z\d])([A-Z])/,'\1_\2').
    tr("-", "_").
    tr(" ", "_").
    downcase
  end
end

class Test2
  def self.my_hash
   {
  "apk" => "file",
  "apktool" => "file",
  "output directory" => "dir",
  "dex2jar" => "file"
  }
  end
  
  def self.run
 	 my_hash.each do |k,v|
  		puts "Please specify the absolute location of the #{k}"
  		instance_variable_set("@#{k}".underscore, gets.chomp)
		unless self.exists(v,k)
			redo
		end
 	 end
 	 execute
 	 rescue ::Interrupt
 	 	puts "\nGoodbye"
  end
    
  def self.exists(data_type, entity)  
  	val = instance_variable_get ("@#{entity}".underscore)
  	case data_type
  	when "dir"
  		Dir.exists?(val)
  	when "file"
  		File.exists?(val)
  	end 
  end
  
  def self.execute
    my_hash.each {|iv, data| puts instance_variable_get("@#{iv}".underscore) }
  end
  
    
=begin def self.run
  puts "Please specify the path of the APK file: "
  apk_location = gets.chomp
  puts "Please specify the path of the Dex2Jar executable: "
  dex2jar_location = gets.chomp
{'fraction_non_alphanumeric': 0.16479063484916703, 'fraction_numerical': 0.007203962179198559, 'mean_word_length': 2.7470489038785835, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, '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': '1008820', 'n_tokens_mistral': 917, 'n_tokens_neox': 899, 'n_words': 205}