Class: MatrixQQ::Matrix::DBus
- Inherits:
-
Object
- Object
- MatrixQQ::Matrix::DBus
- Defined in:
- lib/matrix_qq/matrix/dbus.rb
Instance Attribute Summary collapse
-
#obj ⇒ Object
readonly
Returns the value of attribute obj.
Instance Method Summary collapse
-
#initialize(dbus) ⇒ DBus
constructor
A new instance of DBus.
- #method_missing(name, *args) ⇒ Object
- #respond_to_missing?(name, include_private = false) ⇒ Boolean
Constructor Details
#initialize(dbus) ⇒ DBus
Returns a new instance of DBus.
6 7 8 9 10 |
# File 'lib/matrix_qq/matrix/dbus.rb', line 6 def initialize(dbus) srv = dbus.service('org.dastudio.matrix') @obj = srv.object '/org/dastudio/matrix' @obj.default_iface = 'org.dastudio.matrix' end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
16 17 18 19 20 |
# File 'lib/matrix_qq/matrix/dbus.rb', line 16 def method_missing(name, *args) super if args.size > 2 args << {} if args.size == 1 JSON.parse @obj.send(name, args[0], args[1].to_json).first end |
Instance Attribute Details
#obj ⇒ Object (readonly)
Returns the value of attribute obj.
4 5 6 |
# File 'lib/matrix_qq/matrix/dbus.rb', line 4 def obj @obj end |
Instance Method Details
#respond_to_missing?(name, include_private = false) ⇒ Boolean
12 13 14 |
# File 'lib/matrix_qq/matrix/dbus.rb', line 12 def respond_to_missing?(name, include_private = false) @obj.respond_to_missing? name, include_private end |