Dir[ARGV[1] || 'algorithms/**/*.md'].each do |filename|
  matcher = File.read(filename).match(/~~~\n(require 'rspec'\n.+?)\n~~~/m)

  next if matcher.nil?

  puts "Evaluating #{filename}"
  matcher.captures.each { |capture| eval capture }
end
Dir[ENV['MD'] || 'algorithms/**/*.md'].each do |filename|
  File.read(filename).scan(/~~~\n(require 'rspec'\n.+?)\n~~~/m).flatten.each_with_index do |snippet, i|
    puts "Evaluating #{i + 1} snippet in #{filename}"
    eval snippet
  end
end
Simplify spec helper even further and use scan so that we can evaluate all snippets in a file.
Simplify spec helper even further and use scan so that we can evaluate all snippets in a file.
