Skip to content

Instantly share code, notes, and snippets.

@alekst
alekst / anagram.rb
Created September 3, 2013 21:51 — forked from shepmaster/anagram.rb
class AnagramTest < MiniTest::Unit::TestCase
class Anagram
def initialize(word)
@word = word
# If you create the array here, then the results will be
# collected over multiple calls to `match`. Not sure if that is
# intended or not, so I'll assume it's ok to change.
end
@alekst
alekst / dna.rb
Created September 6, 2013 15:40 — forked from shepmaster/dna.rb
class DNATest < MiniTest::Unit::TestCase
# You don't have to put your classes inside of the test case, but it
# doesn't hurt for these examples
class DNA
def initialize(string)
@string = string
# You can provide a default value for hashes. This also avoids
# hardcoding the letters here.
@counts = Hash.new(0)