Class: Circus::Agents::DBusPromise

Inherits:
Object
  • Object
show all
Defined in:
lib/circus/agents/dbus_connection.rb

Instance Method Summary collapse

Constructor Details

#initialize(bus) ⇒ DBusPromise

Returns a new instance of DBusPromise.



62
63
64
65
66
67
# File 'lib/circus/agents/dbus_connection.rb', line 62

def initialize(bus)
  @bus = bus
  @l = DBus::Main.new
  @l << @bus
  @result = nil
end

Instance Method Details

#completed!(result) ⇒ Object



79
80
81
82
# File 'lib/circus/agents/dbus_connection.rb', line 79

def completed!(result)
  @result = result
  @l.quit
end

#resultObject



69
70
71
72
73
74
75
76
77
# File 'lib/circus/agents/dbus_connection.rb', line 69

def result
  @l.run
  
  if @result.is_a? DBus::Error
    raise @result
  else
    @result.params[0]
  end
end