Method: Mac::Skype::Agent#initialize
- Defined in:
- lib/mac-skype/agent.rb
#initialize ⇒ Agent
Returns a new instance of Agent.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/mac-skype/agent.rb', line 10 def initialize on_receive = Proc.new do |response| if response =~ /^#/ _, id, response_body = response.match(/^#([^\s]+) (.+)/m).to_a if callbacks[id] callbacks[id].call(response_body) callbacks.delete(id) end else .push(response) end end api.callback = on_receive end |