Ticket #25: net.example.Test

File net.example.Test, 450 bytes (added by trac.luon.net@…, 11 years ago)
Line 
1#!/usr/bin/env ruby
2
3require 'dbus'
4
5def main
6  bus = DBus::SessionBus.instance
7  service = bus.request_service 'net.example.Test'
8  service.export Test.new
9
10  l = DBus::Main.new
11  l << bus
12  l.run
13end
14
15class Test < DBus::Object
16  def initialize
17    super '/net/example/Test'
18  end
19
20  dbus_interface 'net.example.Test' do
21    dbus_method :foo, 'in a:s, in b:s, out ret:s' do |*args|
22      [args.join(', ')]
23    end
24  end
25end
26
27main if $0 == __FILE__