summaryrefslogtreecommitdiff
path: root/lib/exirc/example_handler.ex
diff options
context:
space:
mode:
authorJeff Weiss <jeff.weiss@puppetlabs.com>2016-03-29 22:40:07 -0700
committerJeff Weiss <jeff.weiss@puppetlabs.com>2016-03-29 22:40:07 -0700
commit1ca809736246fc25ce07f45bcbd3eeb787e2adf6 (patch)
tree049bfe413427c90cf36beaa82eaf8031f8318801 /lib/exirc/example_handler.ex
parentprefer Elixir module variants over Erlang ones (diff)
Prefer Keyword list syntax for Map key-value pairs
Prior to this commit exirc had inconsistent formatting for Map key-value pairs, some cases used the Keyword list style (`key: value`), while other used the traditional Map fat arrow style (`:key => value`). This commit standardizes the codebase on the Keyword list style because 1) all the Map/struct keys are atoms enabling use of the Keyword list style, and 2) the Keyword list style is more compact.
Diffstat (limited to 'lib/exirc/example_handler.ex')
-rw-r--r--lib/exirc/example_handler.ex8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/exirc/example_handler.ex b/lib/exirc/example_handler.ex
index 251afaf..48774fd 100644
--- a/lib/exirc/example_handler.ex
+++ b/lib/exirc/example_handler.ex
@@ -27,10 +27,10 @@ defmodule ExampleHandler do
def handle_info(:logged_in, _state) do
IO.puts "Logged in!"
end
- def handle_info(%IrcMessage{:nick => from, :cmd => "PRIVMSG", :args => ["mynick", msg]}, _state) do
+ def handle_info(%IrcMessage{nick: from, cmd: "PRIVMSG", args: ["mynick", msg]}, _state) do
IO.puts "Received a private message from \#{from}: \#{msg}"
end
- def handle_info(%IrcMessage{:nick => from, :cmd => "PRIVMSG", :args => [to, msg]}, _state) do
+ def handle_info(%IrcMessage{nick: from, cmd: "PRIVMSG", args: [to, msg]}, _state) do
IO.puts "Received a message in \#{to} from \#{from}: \#{msg}"
end
"""
@@ -111,11 +111,11 @@ defmodule ExampleHandler do
{:noreply, nil}
end
# This is an example of how you can manually catch commands if ExIrc.Client doesn't send a specific message for it
- def handle_info(%IrcMessage{:nick => from, :cmd => "PRIVMSG", :args => ["testnick", msg]}, _state) do
+ def handle_info(%IrcMessage{nick: from, cmd: "PRIVMSG", args: ["testnick", msg]}, _state) do
debug "Received a private message from #{from}: #{msg}"
{:noreply, nil}
end
- def handle_info(%IrcMessage{:nick => from, :cmd => "PRIVMSG", :args => [to, msg]}, _state) do
+ def handle_info(%IrcMessage{nick: from, cmd: "PRIVMSG", args: [to, msg]}, _state) do
debug "Received a message in #{to} from #{from}: #{msg}"
{:noreply, nil}
end