Class: Hipbot::Adapters::Telnet

Inherits:
Object
  • Object
show all
Includes:
Hipbot::Adaptable
Defined in:
lib/hipbot/adapters/telnet.rb

Defined Under Namespace

Classes: Connection

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Hipbot::Adaptable

#invite_to_room, #join_room, #kick_from_room, #leave_room, #restart!, #send_to_room, #set_presence, #set_topic

Instance Attribute Details

#connectionObject

Returns the value of attribute connection.



6
7
8
# File 'lib/hipbot/adapters/telnet.rb', line 6

def connection
  @connection
end

Instance Method Details

#send_to_user(user, message) ⇒ Object



12
13
14
# File 'lib/hipbot/adapters/telnet.rb', line 12

def send_to_user user, message
  connection.send_data("#{self}:#{user}:#{message}\n")
end

#start!Object



8
9
10
# File 'lib/hipbot/adapters/telnet.rb', line 8

def start!
  ::EM::start_server('0.0.0.0', 3001, Connection, self)
end