Skip to content

Instantly share code, notes, and snippets.

@edubkendo
Created March 21, 2015 03:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save edubkendo/b0422494f6b9bb2cbc9c to your computer and use it in GitHub Desktop.
Save edubkendo/b0422494f6b9bb2cbc9c to your computer and use it in GitHub Desktop.
# lib/my_app.ex
defmodule MyApp do
import MyApp.Blah
def foo do
# because we imported it, we can call the `bar` function directly
bar
end
end
# lib/my_app/blah.ex
defmodule MyApp.Blah do
def bar do
"something"
end
end
# lib/my_app/qux.ex
defmodule MyApp.Qux do
def baz do
# even without importing it, we can still call `bar` if we give the full module path
MyApp.Blah.bar
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment