Skip to content

Instantly share code, notes, and snippets.

@djthread
Created November 2, 2018 15:47
Show Gist options
  • Save djthread/eba87074f048f544087741f735f1178f to your computer and use it in GitHub Desktop.
Save djthread/eba87074f048f544087741f735f1178f to your computer and use it in GitHub Desktop.

Revisions

  1. djthread created this gist Nov 2, 2018.
    11 changes: 11 additions & 0 deletions wacky-macro.ex
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    defmodule WackyMacro do
    defmacro defalias(alias_name, alias_path) do
    quote bind_quoted: [alias_name: alias_name, alias_path: alias_path] do
    defmacro unquote(:"get_#{alias_name}")(path) do
    quote bind_quoted: [path: path, alias_path: alias_path] do
    get(var!(assigns).render_meta.parsed, alias_path ++ path)
    end
    end
    end
    end
    end