Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Minor source code formatting improvements

  • Loading branch information...
commit 58fc1b258e1e164f873834970f9c57bcbcce8f0b 1 parent cb44c89
Yurii Rashkovskii authored
Showing with 27 additions and 29 deletions.
  1. +3 −5 lib/gen.ex
  2. +14 −14 lib/gen_event.ex
  3. +10 −10 lib/gen_server.ex
View
8 lib/gen.ex
@@ -1,6 +1,6 @@
defmodule GenX.Gen do
def defhandler(callback, send, f, options) do
- defhandler(callback, send, f, options, [])
+ defhandler(callback, send, f, options, [])
end
def defhandler(callback, send, {function,l,nil}, options, extras) do
defhandler(callback, send, {function,l,[]}, options, extras)
@@ -52,16 +52,14 @@ defmodule GenX.Gen do
unquote(state)), do: unquote(options[:do])
unless Module.defines?(__MODULE__,
{unquote(export[:name]),
- unquote(arity)}) and
+ unquote(arity)}) and
unquote(export[:name]) !== false do
def unquote(export[:name]).(unquote_splicing(full_arguments)) do
- unquote(m).unquote(f)(unquote_splicing(args))
+ unquote(m).unquote(f)(unquote_splicing(args))
end
end
-
end
end
-
end
View
28 lib/gen_event.ex
@@ -32,17 +32,17 @@ end
defmodule GenX.GenEvent do
import GenX.Gen
- defmacro defevent(event, options, body) do
- notify = case (options[:sync]||false) do
- true -> :sync_notify
- false -> :notify
- end
+ defmacro defevent(event, options, body) do
+ notify = case (options[:sync]||false) do
+ true -> :sync_notify
+ false -> :notify
+ end
defhandler(:handle_event, {:gen_event, notify}, event, Keyword.from_enum(options ++ body))
- end
+ end
- defmacro defevent(event, body) do
+ defmacro defevent(event, body) do
defhandler(:handle_event, {:gen_event, :notify}, event, body)
- end
+ end
defmacro defcall(call, options, body) do
send = case (options[:export]||[])[:timeout] do
@@ -51,17 +51,17 @@ defmodule GenX.GenEvent do
end
defhandler(:handle_call, {:gen_event, :call}, call, Keyword.from_enum(options ++ body), [before_request: [(quote do: __MODULE__)], send: send])
end
+
defmacro defcall(call, body) do
- defhandler(:handle_call, {:gen_event, :call}, call, body, [before_request: [(quote do: __MODULE__)]])
+ defhandler(:handle_call, {:gen_event, :call}, call, body, [before_request: [(quote do: __MODULE__)]])
end
- defmacro definfo(info, options, body) do
+ defmacro definfo(info, options, body) do
defhandler(:handle_info, {:erlang, :send}, info, Keyword.from_enum(options ++ body))
- end
+ end
- defmacro definfo(info, body) do
+ defmacro definfo(info, body) do
defhandler(:handle_info, {:erlang, :send}, info, body)
- end
-
+ end
end
View
20 lib/gen_server.ex
@@ -73,17 +73,17 @@ defmodule GenX.GenServer do
@doc handle_call_doc
defmacro defcall(call, options, body) do
- unless is_list(options[:export]) or options[:export] == nil, do: options = Keyword.put options, :export, [server: options[:export]]
- send = case (options[:export]||[])[:timeout] do
- nil -> []
- v -> [v]
- end
+ unless is_list(options[:export]) or options[:export] == nil, do: options = Keyword.put options, :export, [server: options[:export]]
+ send = case (options[:export]||[])[:timeout] do
+ nil -> []
+ v -> [v]
+ end
defhandler(:handle_call, {:gen_server, :call}, call, Keyword.from_enum(options ++ body), [handle: [:from], send: send])
end
@doc handle_call_doc
defmacro defcall(call, body) do
- defhandler(:handle_call, {:gen_server, :call}, call, body, [handle: [:from]])
+ defhandler(:handle_call, {:gen_server, :call}, call, body, [handle: [:from]])
end
handle_cast_doc = """
@@ -121,11 +121,11 @@ defmodule GenX.GenServer do
@doc handle_cast_doc
defmacro defcast(cast, options, body) do
- defhandler(:handle_cast, {:gen_server, :cast}, cast, Keyword.from_enum(options ++ body))
+ defhandler(:handle_cast, {:gen_server, :cast}, cast, Keyword.from_enum(options ++ body))
end
@doc handle_cast_doc
defmacro defcast(cast, body) do
- defhandler(:handle_cast, {:gen_server, :cast}, cast, body)
+ defhandler(:handle_cast, {:gen_server, :cast}, cast, body)
end
handle_info_doc = """
@@ -163,11 +163,11 @@ defmodule GenX.GenServer do
@doc handle_info_doc
defmacro definfo(info, options, body) do
- defhandler(:handle_info, {:erlang, :send}, info, Keyword.from_enum(options ++ body))
+ defhandler(:handle_info, {:erlang, :send}, info, Keyword.from_enum(options ++ body))
end
@doc handle_info_doc
defmacro definfo(info, body) do
- defhandler(:handle_info, {:erlang, :send}, info, body)
+ defhandler(:handle_info, {:erlang, :send}, info, body)
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.