Current section
Files
Jump to
Current section
Files
lib/engine/vinyl-file.ex
defmodule Reblog.Engine.VinylFile do
@moduledoc """
Reblog engine basic VinylFile protocol.
"""
@enforce_keys [:path, :base, :basename, :stem, :ext, :dirname, :contents]
defstruct [:path, :base, :basename, :stem, :ext, :dirname, :contents]
def new(path) do
contents = File.read!(path)
ext = Path.extname(path)
%Reblog.Engine.VinylFile{
path: path,
base: List.first(Path.split(path)),
basename: Path.basename(path),
stem: Path.basename(path, ext),
ext: ext,
dirname: Path.dirname(path),
contents: contents
}
end
end