Class: Skype::AbstractObject
- Inherits:
-
Object
- Object
- Skype::AbstractObject
- Defined in:
- lib/skype/object.rb
Overview
:nodoc: all
Direct Known Subclasses
Application, Call, Chat, ChatMember, ChatMessage, Event, FileTransfer, Group, MenuItem, Message, Profile, SMS, User, VoiceMail
Defined Under Namespace
Modules: Get, Invokers, Notify, Parser
Constant Summary collapse
- @@instance =
Hash.new do |hash,key| hash[key] = Hash.new end
- @@skypeApi =
Skype
Instance Attribute Summary
Attributes included from Get
#property2callback, #property2symbol
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id) ⇒ AbstractObject
constructor
A new instance of AbstractObject.
- #to_s ⇒ Object
Methods included from Notify
delNotify, notified, notify, setNotify
Methods included from Get
Methods included from Invokers
#invoke_alter, #invoke_echo, #invoke_get, #invoke_one, #invoke_set
Constructor Details
#initialize(id) ⇒ AbstractObject
Returns a new instance of AbstractObject.
226 227 228 |
# File 'lib/skype/object.rb', line 226 def initialize id @id = id end |
Class Method Details
.inherited(sub) ⇒ Object
185 186 187 188 189 190 191 |
# File 'lib/skype/object.rb', line 185 def self.inherited sub if self == AbstractObject sub.instance_variable_set :@property2symbol, Hash.new{|hash,key| hash[key] = key} sub.instance_variable_set :@property2callback, Hash.new end sub.instance_variable_set :@notify, Hash.new end |
.new(id) ⇒ Object
213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/skype/object.rb', line 213 def self.new id if @@instance[self][id] return @@instance[self][id] else instance = super id instance.instance_variable_set(:@notify, Hash.new do |h,k| h[k] = Hash.new end) @@instance[self][id] = instance return instance end end |
.notified(msg) ⇒ Object
193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/skype/object.rb', line 193 def self.notified msg if msg =~ /^([^ ]+) ([^ ]+) (.*)$/m id = $1; skypeProperty = $2; value = $3 instance = new id property = @property2symbol[skypeProperty].to_s.downcase.to_sym if @property2symbol[skypeProperty].class == Symbol value = @property2callback[skypeProperty].call value if @property2callback[skypeProperty] if @notify[nil] @notify[nil][nil].call instance, property, value if @notify[nil][nil] @notify[nil][value].call instance, property if @notify[nil][value] end if @notify[property] @notify[property][nil].call instance, value if @notify[property][nil] @notify[property][value].call instance if @notify[property][value] end @@instance[self][id].notified instance, property, value if @@instance[self][id] end end |
Instance Method Details
#to_s ⇒ Object
230 231 232 |
# File 'lib/skype/object.rb', line 230 def to_s @id.to_s end |