Class: NotifySocket

Inherits:
Object
  • Object
show all
Defined in:
lib/notify_socket.rb

Overview

Instance Method Summary collapse

Constructor Details

#initialize(path = ENV['NOTIFY_SOCKET']) ⇒ NotifySocket

Returns a new instance of NotifySocket.



27
28
29
30
31
# File 'lib/notify_socket.rb', line 27

def initialize(path=ENV['NOTIFY_SOCKET'])
  @notify_socket = nil
  return unless path
  @notify_socket = Addrinfo.unix(path, :DGRAM).connect
end

Instance Method Details

#[]=(key, value) ⇒ Object



33
34
35
36
# File 'lib/notify_socket.rb', line 33

def []=(key, value)
  return unless @notify_socket
  @notify_socket.puts "#{key}=#{value}"
end

#buserror=(error_code) ⇒ Object

notify_socket.buserror = ‘org.freedesktop.DBus.Error.TimedOut’



61
62
63
# File 'lib/notify_socket.rb', line 61

def buserror=(error_code)
  self['BUSERROR'] = error_code
end

#errno=(error_code) ⇒ Object

notify_socket.errno = 2



56
57
58
# File 'lib/notify_socket.rb', line 56

def errno=(error_code)
  self['ERRNO'] = error_code
end

#extend_timeout_usec=(usec) ⇒ Object



79
80
81
# File 'lib/notify_socket.rb', line 79

def extend_timeout_usec=(usec)
  self['EXTEND_TIMEOUT_USEC'] = usec
end

#mainpid=(pid) ⇒ Object

notify_socket.mainpid = 4711



66
67
68
# File 'lib/notify_socket.rb', line 66

def mainpid=(pid)
  self['MAINPID'] = pid
end

#ready!Object



38
39
40
# File 'lib/notify_socket.rb', line 38

def ready!
  self['READY'] = 1
end

#reloading!Object



42
43
44
# File 'lib/notify_socket.rb', line 42

def reloading!
  self['RELOADING'] = 1
end

#status=(state) ⇒ Object

notify_socket.status = ‘Completed 66% of file system check…’



51
52
53
# File 'lib/notify_socket.rb', line 51

def status=(state)
  self['STATUS'] = state
end

#stopping!Object



46
47
48
# File 'lib/notify_socket.rb', line 46

def stopping!
  self['STOPPING'] = 1
end

#watchdog!Object



70
71
72
# File 'lib/notify_socket.rb', line 70

def watchdog!
  self['WATCHDOG'] = 1
end

#watchdog_usec=(usec) ⇒ Object

notify_socket.watchdog_usec = 20_000_000



75
76
77
# File 'lib/notify_socket.rb', line 75

def watchdog_usec=(usec)
  self['WATCHDOG_USEC'] = usec
end