Skip to content

Commit

Permalink
Merge pull request #4 from zoldar/opts
Browse files Browse the repository at this point in the history
Remove the need to explicitly declare opts in user's module
  • Loading branch information
aerosol committed Oct 30, 2015
2 parents e1a1d91 + 1576085 commit 0db1af4
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/tabula.ex
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,12 @@ defmodule Tabula do

defmacro __using__(opts) do
quote do
@opts unquote(opts)
def opts, do: @opts
def print_table(rows) do
unquote(__MODULE__).print_table(rows, opts)
unquote(__MODULE__).print_table(rows, unquote(opts))
end
def print_table(rows, override_opts) do
unquote(__MODULE__).print_table(
rows, Keyword.merge(opts, override_opts)
rows, Keyword.merge(unquote(opts), override_opts)
) end
end
end
Expand Down

0 comments on commit 0db1af4

Please sign in to comment.