Class: MoonBot::Client

Inherits:
EventMachine::Connection
  • Object
show all
Defined in:
lib/MoonBot/client.rb

Instance Method Summary collapse

Constructor Details

#initialize(on_message) ⇒ Client

Returns a new instance of Client.



4
5
6
# File 'lib/MoonBot/client.rb', line 4

def initialize on_message
  @on_message = on_message
end

Instance Method Details

#derp(x) ⇒ Object



16
17
18
# File 'lib/MoonBot/client.rb', line 16

def derp x
  puts "herp"
end

#receive_data(data) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/MoonBot/client.rb', line 8

def receive_data(data)
  data = data.split "\r\n"
  data.each do |d|
    message = Parser::parse(d)
    @on_message.call(message) if @on_message
  end
end