Files
elixir-koans/lib/watcher.ex

17 lines
362 B
Elixir

defmodule Watcher do
use ExFSWatch, dirs: ["lib/koans"]
def callback(file, events) do
if Enum.member?(events, :modified) do
try do
Code.load_file(file)
|> Enum.map(&(elem(&1, 0)))
|> Enum.find(&Runner.koan?/1)
|> Runner.run
rescue
e -> Display.show_compile_error(e)
end
end
end
end