Skip to content
This repository has been archived by the owner on Apr 14, 2018. It is now read-only.

Commit

Permalink
Added method deprecation reminders and updated comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrien Thebo committed Oct 16, 2011
1 parent 8ebbb6c commit c40c3d2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions lib/wrack/connection.rb
Expand Up @@ -62,6 +62,7 @@ def poll

# Takes either an object that responds to a callback or a block that
# receives a single argument
# XXX Remove array callback_type to simplify this method?
def register_callback(callback_type, options = {}, &block)
# Validate type
case callback_type
Expand Down Expand Up @@ -103,6 +104,10 @@ def fire_callbacks(type, raw)
end
end

# Convenience method to set signal handlers to terminate a connection
# This is implemented outside of the connect method so that classes
# reimplementing the connect method can just call this instead of calling
# the super method
def set_signals
%w{INT TERM QUIT}.each do |signal|
Signal.trap(signal) do
Expand Down
7 changes: 5 additions & 2 deletions lib/wrack/session.rb
@@ -1,5 +1,5 @@
# Assembles the higher level components of an IRC connection on top of a raw
# socket. Manages callbacks and maintains the connection.
# Abstraction on top of a raw Wrack::Connection to manage IRC level
# callbacks
require 'wrack'
require 'wrack/irc'
module Wrack
Expand All @@ -17,11 +17,13 @@ def initialize(options = {})
# Initialize IRC level callback mechanism
register_message_handler

# XXX REMOVE ME
on :ping do |msg|
pong(msg.params)
end
end

# XXX REMOVE ME
def connect
@connection.connect
end
Expand All @@ -35,6 +37,7 @@ def receive(context, &block)
@receivers << receiver
end

# XXX REMOVE ME
def on(command, options = {}, &block)
callback = Wrack::IRC::Callback.new(command, options, &block)
@callbacks[command] ||= []
Expand Down

0 comments on commit c40c3d2

Please sign in to comment.