Skip to content

Commit 8cf202e

Browse files
committed
Extract file listing to methods
1 parent 4b700f6 commit 8cf202e

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

lib/onigumo/parser.ex

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,18 @@ defmodule Onigumo.Parser do
55

66
def main(root_path) do
77
root_path
8-
|> File.ls!()
9-
|> Enum.filter(fn filename -> Path.extname(filename) == ".raw" end)
8+
|> list_downloaded()
109
|> Enum.map(&IO.puts(&1))
1110
end
11+
12+
defp list_downloaded(path) do
13+
path
14+
|> File.ls!()
15+
|> Enum.filter(&is_downloaded(&1))
16+
end
17+
18+
defp is_downloaded(path) do
19+
suffix = Application.get_env(:onigumo, :downloaded_suffix)
20+
Path.extname(path) == ".#{suffix}"
21+
end
1222
end

0 commit comments

Comments
 (0)