Add :eph field to %TranslationUnit{} and remove :sibling_with
Using :eph from now on to store ephemeral data like :sibling_with. Additionally added cleaning up :eph before saving to db. And renamed InternalTree.Basic to InternalTree.RawInternalBasic to make clear that it contains function for an intermediary tree structure.
This commit is contained in:
@ -3,6 +3,7 @@ defmodule Outlook.Articles.InternalTree do
|
||||
|
||||
alias Outlook.InternalTree.InternalNode
|
||||
alias Outlook.InternalTree.TranslationUnit
|
||||
alias Outlook.InternalTree.Basic
|
||||
|
||||
def type, do: :string
|
||||
|
||||
@ -16,7 +17,10 @@ defmodule Outlook.Articles.InternalTree do
|
||||
{:ok, Jason.decode!(tree, keys: :atoms!) |> from_json}
|
||||
end
|
||||
|
||||
def dump(tree) when is_list(tree), do: {:ok, Jason.encode!(tree)}
|
||||
def dump(tree) when is_list(tree) do
|
||||
{:ok, Basic.clean_eph(tree) |> Jason.encode!()}
|
||||
end
|
||||
|
||||
def dump(_), do: :error
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user