Last active
October 23, 2016 03:51
-
-
Save catsby/6623829 to your computer and use it in GitHub Desktop.
Requiring relatively with Elixir
This file contains hidden or 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
$ ls | |
other_thing.exs | |
thing.exs | |
$ elixir thing.exs | |
calling other | |
other thing! | |
hooray! |
This file contains hidden or 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 OtherThing do | |
def other do | |
IO.puts "other thing!" | |
end | |
end |
This file contains hidden or 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 Thing do | |
Code.require_file "other_thing.exs", __DIR__ | |
def do_something do | |
IO.puts "calling other" | |
OtherThing.other() | |
IO.puts "hooray!" | |
end | |
end | |
Thing.do_something() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment