Skip to content

Commit

Permalink
Add temporary parse function to Statifier api
Browse files Browse the repository at this point in the history
We can use this function to test out our parsing of schemas and
transitions of the machines. This is not a long term function to have in
the api.
  • Loading branch information
skbolton authored and johnnyt committed Aug 4, 2020
1 parent 83f9fd5 commit 3d607a2
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions impl/ex/lib/statifier.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
defmodule Statifier do
def parse() do
:statifier
|> :code.priv_dir()
|> Path.join("scxml/microwave.scxml")
|> Statifier.Codec.SCXML.parse()
end

def parse(file) do
codec =
if String.ends_with?(file, ".yaml") do
Statifier.Codec.YAML
else
Statifier.Codec.SCXML
end

:statifier
|> :code.priv_dir()
|> Path.join(file)
|> codec.parse()
end
end

0 comments on commit 3d607a2

Please sign in to comment.