Module: Officer::Connection::EmCallbacks

Included in:
Connection
Defined in:
lib/officer/connection.rb

Instance Method Summary collapse

Instance Method Details

#post_initObject



5
6
7
8
9
10
11
# File 'lib/officer/connection.rb', line 5

def post_init
  @connected = true
  @timers = {} # name => Timer
  @last_cmd_at = Time.now.utc

  Officer::Log.info "Connected: #{to_host_s}"
end

#receive_line(line) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/officer/connection.rb', line 13

def receive_line line
  line.chomp!

  Officer::Log.debug "#{to_host_s} received line: #{line}"

  command = Officer::Command::Factory.create line, self
  command.execute
  @last_cmd_at = Time.now.utc

rescue Exception => e
  Officer::Log.error e
  raise
end

#unbindObject



27
28
29
30
31
32
33
# File 'lib/officer/connection.rb', line 27

def unbind
  @connected = false

  Officer::LockStore.instance.reset self

  Officer::Log.info "Disconnected: #{to_host_s}"
end