Current section

Files

Jump to
crawlberg lib crawlberg link_info.ex
Raw

lib/crawlberg/link_info.ex

# This file is auto-generated by alef — DO NOT EDIT.
# alef:hash:033f5eca7fbc34bfd4671a4317e70b36ebfd9f5f5cf417b942c113c920a71e34
# To regenerate: alef generate
# To verify freshness: alef verify --exit-code
defmodule Crawlberg.LinkInfo do
@moduledoc "Information about a link found on a page."
@typedoc "Information about a link found on a page."
@type t :: %__MODULE__{
url: String.t() | nil,
text: String.t() | nil,
link_type: String.t() | nil,
rel: String.t() | nil,
nofollow: boolean()
}
defstruct url: nil,
text: nil,
link_type: :internal,
rel: nil,
nofollow: false
defimpl Jason.Encoder do
@doc false
def encode(value, opts) do
value
|> Map.from_struct()
|> Enum.reject(fn {_k, v} -> v == nil end)
|> Enum.into(%{})
|> Jason.Encoder.encode(opts)
end
end
end