Class: SkypeAPI::OS::Abstruct
- Inherits:
-
Object
- Object
- SkypeAPI::OS::Abstruct
- Defined in:
- lib/skypeapi/os/etc.rb
Instance Method Summary collapse
- #add_hook(sym, block = Proc.new) ⇒ Object
- #attach(name = nil) ⇒ Object
- #attach_wait(name = nil) ⇒ Object
- #close ⇒ Object
- #del_hook(sym, block = nil) ⇒ Object
- #exist_hook?(sym) ⇒ Boolean
- #get_hook(sym) ⇒ Object
-
#initialize ⇒ Abstruct
constructor
A new instance of Abstruct.
- #invoke(cmd) ⇒ Object
- #invoke_block(cmd) ⇒ Object
- #invoke_callback(cmd, callback = Proc.new) ⇒ Object
Constructor Details
#initialize ⇒ Abstruct
Returns a new instance of Abstruct.
7 8 9 10 11 12 13 14 15 |
# File 'lib/skypeapi/os/etc.rb', line 7 def initialize @send_count = 0 @hook = Hash.new do |h,k| h[k] = Array.new end @attached = false @first_attached = true @raise_when_detached = false end |
Instance Method Details
#add_hook(sym, block = Proc.new) ⇒ Object
17 18 19 20 |
# File 'lib/skypeapi/os/etc.rb', line 17 def add_hook sym, block=Proc.new @hook[sym].push block block end |
#attach(name = nil) ⇒ Object
72 73 |
# File 'lib/skypeapi/os/etc.rb', line 72 def attach name = nil end |
#attach_wait(name = nil) ⇒ Object
75 76 |
# File 'lib/skypeapi/os/etc.rb', line 75 def attach_wait name = nil end |
#close ⇒ Object
78 79 |
# File 'lib/skypeapi/os/etc.rb', line 78 def close end |
#del_hook(sym, block = nil) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/skypeapi/os/etc.rb', line 22 def del_hook sym, block=nil unless block @hook[sym] = Array.new else @hook[sym].delete block end end |
#exist_hook?(sym) ⇒ Boolean
30 31 32 33 34 35 36 |
# File 'lib/skypeapi/os/etc.rb', line 30 def exist_hook? sym if @hook[sym].length > 0 return true else return false end end |
#get_hook(sym) ⇒ Object
38 39 40 |
# File 'lib/skypeapi/os/etc.rb', line 38 def get_hook sym @hook[sym] end |
#invoke(cmd) ⇒ Object
47 48 49 50 51 52 53 54 55 |
# File 'lib/skypeapi/os/etc.rb', line 47 def invoke cmd begin check_response(invoke_block(cmd), cmd) rescue SkypeAPI::Error::API => e e.backtrace.shift e.backtrace.shift raise e end end |
#invoke_block(cmd) ⇒ Object
60 61 |
# File 'lib/skypeapi/os/etc.rb', line 60 def invoke_block cmd end |
#invoke_callback(cmd, callback = Proc.new) ⇒ Object
57 58 |
# File 'lib/skypeapi/os/etc.rb', line 57 def invoke_callback cmd, callback = Proc.new end |