Module: DBusInterface::Object

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(some_base) ⇒ Object



2
3
4
# File 'lib/dbus_interface/object.rb', line 2

def self.included(some_base)
  some_base.extend(DBusInterface::Class)
end

Instance Method Details

#[](key) ⇒ Object

shortcut to access properties



35
36
37
# File 'lib/dbus_interface/object.rb', line 35

def [](key)
  properties[key]
end

#call(method, *args) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/dbus_interface/object.rb', line 6

def call(method, *args)
  if object_path == nil || object_path == '/'
    nil
  else
    DBusInterface::Connection.call(self.class.default_iface, object_path, method, *args)
  end
end

#initialize(object_path = nil) ⇒ Object



22
23
24
# File 'lib/dbus_interface/object.rb', line 22

def initialize(object_path = nil)
  self.object_path = object_path if object_path
end

#object_pathObject



30
31
32
# File 'lib/dbus_interface/object.rb', line 30

def object_path
  @object_path || self.class.object_path
end

#object_path=(p) ⇒ Object



26
27
28
# File 'lib/dbus_interface/object.rb', line 26

def object_path=(p)
  @object_path = p
end

#propertiesObject



14
15
16
17
18
19
20
# File 'lib/dbus_interface/object.rb', line 14

def properties
  if self.class.no_properties?
    nil
  else
    call('all_properties')
  end
end

#to_sObject



39
40
41
# File 'lib/dbus_interface/object.rb', line 39

def to_s
  "#{self.class} #{properties}"
end