Class: SkypeAPI::OS::Mac
- Inherits:
-
Object
- Object
- SkypeAPI::OS::Mac
- Defined in:
- lib/skypeapi/os/mac.rb
Defined Under Namespace
Classes: Server
Instance Attribute Summary collapse
-
#attached ⇒ Object
readonly
Returns the value of attribute attached.
Instance Method Summary collapse
- #attach ⇒ Object
- #attach_wait ⇒ Object
- #dettach ⇒ Object
-
#initialize(client_application_name = 'ruby4skype') ⇒ Mac
constructor
A new instance of Mac.
- #invoke_block(cmd, waitLimit = WAIT_CMD_LIMIT) ⇒ Object
- #invoke_callback(cmd, cb = Proc.new) ⇒ Object
- #invoke_prototype(cmd) ⇒ Object
- #skype_runnging? ⇒ Boolean
Constructor Details
#initialize(client_application_name = 'ruby4skype') ⇒ Mac
Returns a new instance of Mac.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/skypeapi/os/mac.rb', line 39 def initialize client_application_name='ruby4skype' raise Skype::Error::NotImplement @server = Server.alloc.init @server.instance_variable_set :@upper, self @server.instance_variable_set :@client_application_name, @client_application_name OSX::SkypeAPI.setSkypeDelegate @server @notify = Hash.new @event = Hash.new do |h,k| h[k] = Array.new end @attached = false Thread.new do OSX::NSRunLoop.currentRunLoop.run end end |
Instance Attribute Details
#attached ⇒ Object (readonly)
Returns the value of attribute attached.
58 59 60 |
# File 'lib/skypeapi/os/mac.rb', line 58 def attached @attached end |
Instance Method Details
#attach ⇒ Object
60 61 62 |
# File 'lib/skypeapi/os/mac.rb', line 60 def attach OSX::SkypeAPI.connect end |
#attach_wait ⇒ Object
64 65 66 67 68 69 70 |
# File 'lib/skypeapi/os/mac.rb', line 64 def attach_wait self.attach loop do break if @attached sleep 0.123 end end |
#dettach ⇒ Object
72 73 74 |
# File 'lib/skypeapi/os/mac.rb', line 72 def dettach OSX::SkypeAPI.disconnect end |
#invoke_block(cmd, waitLimit = WAIT_CMD_LIMIT) ⇒ Object
92 93 94 |
# File 'lib/skypeapi/os/mac.rb', line 92 def invoke_block cmd, waitLimit = WAIT_CMD_LIMIT res = invoke_prototype cmd end |
#invoke_callback(cmd, cb = Proc.new) ⇒ Object
87 88 89 90 |
# File 'lib/skypeapi/os/mac.rb', line 87 def invoke_callback cmd,cb=Proc.new res = invoke_prototype cmd cb.call res end |
#invoke_prototype(cmd) ⇒ Object
80 81 82 83 84 85 |
# File 'lib/skypeapi/os/mac.rb', line 80 def invoke_prototype cmd res = OSX::SkypeAPI.sendSkypeCommand(cmd) @queue.push(proc{do_event(:sent, cmd)}) if exist_event? :sent @queue.push(proc{do_event(:received, res)}) if exist_event? :received return res end |
#skype_runnging? ⇒ Boolean
76 77 78 |
# File 'lib/skypeapi/os/mac.rb', line 76 def skype_runnging? OSX::SkypeAPI.isSkypeRunnging end |