lib/runit-man/service_info.rb in runit-man-1.4.3 vs lib/runit-man/service_info.rb in runit-man-1.4.4
- old
+ new
@@ -5,10 +5,18 @@
def initialize(a_name)
@name = a_name
end
+ def to_json
+ data = {}
+ [ :name, :stat, :active?, :logged?, :switchable?, :run?, :pid, :log_pid, :log_file_location ].each do |sym|
+ data[sym] = send(sym)
+ end
+ data.to_json
+ end
+
def logged?
File.directory?(log_supervise_folder)
end
def stat
@@ -23,10 +31,10 @@
def switchable?
File.symlink?(active_service_folder) || File.directory?(inactive_service_folder)
end
def run?
- stat =~ /\brun\b/
+ !!(stat =~ /\brun\b/)
end
def up!
send_signal! :u
end