Module: Skype::ShareFunctions
- Defined in:
- lib/skype/sharefunctions.rb
Overview
:nodoc: all
Instance Method Summary collapse
-
#invoke_alter(prop, value = nil) ⇒ Object
true�����Ԃ��Ȃ��B������ςȂ��B����ȊO�̕Ԃ茌������悤�Ȃ̂͂�invoke�Ŏ�������B.
-
#invoke_echo(cmd) ⇒ Object
invoke_echo “CREATE APPLICATION #@appName” CREATE APPLICATION #@appName -> CREATE APPLICATION #@appName.
-
#invoke_get(prop, value = nil) ⇒ Object
invoke_get(“GET USER #@handle SkypeOut”) GET USER #@handle SkypeOut -> USER #@handle SkypeOut (.+).
-
#invoke_one(cmd, regExp = cmd) ⇒ Object
invoke_one “GET CHATMESSAGE #@id BODY”, “CHATMESSAGE #@id BODY” GET CHATMESSAGE #@id BODY -> CHATMESSAGE #@id BODY (.+).
- #invoke_set(prop, value = nil) ⇒ Object
Instance Method Details
#invoke_alter(prop, value = nil) ⇒ Object
true�����Ԃ��Ȃ��B������ςȂ��B����ȊO�̕Ԃ茌������悤�Ȃ̂͂�invoke�Ŏ�������B
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/skype/sharefunctions.rb', line 128 def invoke_alter prop, value=nil cmd = "ALTER #{defined?(self.class::OBJECT_NAME) ? self.class::OBJECT_NAME + ' ' : ''}#{@id ? @id.to_s + ' ' : ''}#{prop}#{value ? ' '+value.to_s : '' }" #res = "ALTER #{defined?(self.class::OBJECT_NAME) ? self.class::OBJECT_NAME + ' ' : ''}#{@id ? @id.to_s + ' ' : ''}#{prop}" #reg.gsub!(/[\^$.\\\[\]*+{}?|()]/) do |char| # "\\" + char #end #res = "ALTER #{defined?(self.class::OBJECT_NAME) ? self.class::OBJECT_NAME + ' ' : ''}#{prop}" begin invoke(cmd)# == res rescue Skype::APIError => e e.backtrace.shift e.backtrace.shift raise e end true end |
#invoke_echo(cmd) ⇒ Object
invoke_echo “CREATE APPLICATION #@appName” CREATE APPLICATION #@appName -> CREATE APPLICATION #@appName
67 68 69 70 71 72 73 74 75 |
# File 'lib/skype/sharefunctions.rb', line 67 def invoke_echo cmd begin invoke(cmd) == cmd rescue Skype::APIError => e e.backtrace.shift e.backtrace.shift raise e end end |
#invoke_get(prop, value = nil) ⇒ Object
invoke_get(“GET USER #@handle SkypeOut”) GET USER #@handle SkypeOut -> USER #@handle SkypeOut (.+)
95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/skype/sharefunctions.rb', line 95 def invoke_get prop, value=nil cmd = "GET #{defined?(self.class::OBJECT_NAME) ? self.class::OBJECT_NAME + ' ' : ''}#{@id ? @id.to_s+' ' : ''}#{prop}#{value ? ' ' + value : ''}" reg = "#{defined?(self.class::OBJECT_NAME) ? self.class::OBJECT_NAME + ' ' : ''}#{@id ? @id.to_s+' ' : ''}#{prop}#{value ? ' ' + value : ''}".gsub(/[\^$.\\\[\]*+{}?|()]/) do |char| "\\" + char end begin invoke(cmd) =~ /^#{reg} (.*)$/m rescue Skype::APIError => e e.backtrace.shift e.backtrace.shift raise e end return $1 end |
#invoke_one(cmd, regExp = cmd) ⇒ Object
invoke_one “GET CHATMESSAGE #@id BODY”, “CHATMESSAGE #@id BODY” GET CHATMESSAGE #@id BODY -> CHATMESSAGE #@id BODY (.+)
79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/skype/sharefunctions.rb', line 79 def invoke_one cmd, regExp=cmd regExp.gsub!(/[\^$.\\\[\]*+{}?|()]/) do |char| "\\" + char end begin invoke(cmd) =~ /^#{regExp} (.*)$/m rescue Skype::APIError => e e.backtrace.shift e.backtrace.shift raise e end return $1 end |
#invoke_set(prop, value = nil) ⇒ Object
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/skype/sharefunctions.rb', line 110 def invoke_set prop,value=nil cmd = "SET #{defined?(self.class::OBJECT_NAME) ? self.class::OBJECT_NAME + ' ' : ''}#{@id ? @id.to_s + ' ' : ''}#{prop}#{value ? ' '+value.to_s : '' }" reg = "#{defined?(self.class::OBJECT_NAME) ? self.class::OBJECT_NAME + ' ' : ''}#{@id ? @id.to_s + ' ' : ''}#{prop}" begin str = invoke_one cmd, reg rescue Skype::APIError => e e.backtrace.shift e.backtrace.shift raise e end if self.class == Module self::V2O[prop] ? self::V2O[prop].call(str) : str else self.class::V2O[prop] ? self.class::V2O[prop].call(str) : str end end |