Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Add File.write and File.write_file #313

Merged
merged 1 commit into from May 31, 2012

Conversation

Projects
None yet
3 participants
Contributor

carlosgaldino commented May 30, 2012

They are just simple wrappers for the Erlang functions with the same name

This pull request passes (merged 338f8bb0 into 2973c34).

@josevalim josevalim and 1 other commented on an outdated diff May 30, 2012

lib/file.ex
@@ -391,6 +391,37 @@ defmodule File do
end
end
+ @doc """
+ Tries to write `content` to the file referenced by `io`.
+ Returns `:ok` if successful, or `{:error, reason}` if an error occurs.
+
+ Typical error reasons are:
+
+ * :ebadf - The file is not opened for writing.
+ * :enospc - There is a no space left on the device.
+ """
+ def write(io, content) do
@josevalim

josevalim May 30, 2012

Owner

Do we really need File.write? Ideally, we would simply use IO.write() for that (or IO.putb).

@carlosgaldino

carlosgaldino May 30, 2012

Contributor

Ok. I'll remove that.

@josevalim

josevalim May 30, 2012

Owner

Then we can rename File.write_file to File.write. :)

@carlosgaldino

carlosgaldino May 31, 2012

Contributor

Updated.

This pull request passes (merged 3352b07 into c926b7f).

josevalim added a commit that referenced this pull request May 31, 2012

Merge pull request #313 from carlosgaldino/file-write
Add File.write and File.write_file

@josevalim josevalim merged commit 1fb409f into elixir-lang:master May 31, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment