Here's a bit of code that seems like it should have triggered the indentation/two spaces rule:
class Hamming
def self.compute dna1, dna2
#compute Hamming distance of 2 DNA strings
prep1 = self.prepare dna1
prep2 = self.prepare dna2
self.calculate prep1, prep2
end
def self.prepare(dna)
#preparation steps
dna_hash = Hash.new
dna.split(//).each_with_index do |index, key|
dna_hash[key] = index
end
dna_hash
end
def self.calculate(dna1, dna2)
#if values for the same index are not the same, increase distance
distance = 0
dna1.each do |key, value|
unless dna2[key] == value then distance+=1 end
end
distance
end
end
"class Hamming\r\n def self.compute dna1, dna2\r\n #compute Hamming distance of 2 DNA strings \r\n prep1 = self.prepare dna1 \r\n prep2 = self.prepare dna2 \r\n\r\n self.calculate prep1, prep2\r\n end\r\n\r\n def self.prepare(dna)\r\n #preparation steps\r\n dna_hash = Hash.new \r\n dna.split(//).each_with_index do |index, key|\r\n dna_hash[key] = index \r\n end\r\n dna_hash\r\n end \r\n\r\n def self.calculate(dna1, dna2)\r\n #if values for the same index are not the same, increase distance \r\n distance = 0\r\n dna1.each do |key, value| \r\n unless dna2[key] == value then distance+=1 end\r\n end\r\n distance\r\n end\r\nend"
Here's a bit of code that seems like it should have triggered the indentation/two spaces rule: