Class: Saber::AutoFetcher::Client

Inherits:
Object
  • Object
show all
Includes:
Blather::DSL
Defined in:
lib/saber/autofetcher/client.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeClient

Returns a new instance of Client.



20
21
22
# File 'lib/saber/autofetcher/client.rb', line 20

def initialize
  @fetcher = Fetcher.new
end

Instance Attribute Details

#fetcherObject (readonly)

Returns the value of attribute fetcher.



18
19
20
# File 'lib/saber/autofetcher/client.rb', line 18

def fetcher
  @fetcher
end

Class Method Details

.startObject



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

def start
  c = Client.new
  c.start

  EM.run { c.run }
end

Instance Method Details

#runObject



24
25
26
# File 'lib/saber/autofetcher/client.rb', line 24

def run
  client.run
end

#startObject



28
29
30
31
32
33
34
35
36
37
# File 'lib/saber/autofetcher/client.rb', line 28

def start
  rc = Rc.client.xmpp
  setup rc.jid, rc.password, rc.host, rc.port
  when_ready { Saber.ui.say ">> Connected to xmpp at #{jid}" }
  disconnected { client.connect }

  message :chat?, :body, :from => /#{Rc.server.xmpp.jid}/ do |m|
    process_msg m.body
  end
end

#stopObject



39
40
41
# File 'lib/saber/autofetcher/client.rb', line 39

def stop
  @client.close!
end