This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule Context do | |
@moduledoc false | |
defmacro __using__(opts) do | |
repo = Keyword.fetch!(opts, :repo) | |
quote do | |
import Context, only: [context: 1, context: 2] | |
Module.put_attribute(__MODULE__, :__repo__, unquote(repo)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# starting point (line is too long) | |
def send_mail(source) | |
Mailer.deliver(to: 'bob@example.com', from: 'us@example.com', subject: 'Important message', body: source.text) | |
end | |
# bad (double indent) | |
def send_mail(source) | |
Mailer.deliver( | |
to: 'bob@example.com', | |
from: 'us@example.com', |