Class: VncTools::Server
- Inherits:
-
Object
- Object
- VncTools::Server
- Defined in:
- lib/vnctools/server.rb
Defined Under Namespace
Classes: Error
Class Attribute Summary (collapse)
Instance Attribute Summary (collapse)
-
- (Object) display
readonly
Returns the value of attribute display.
Class Method Summary (collapse)
Instance Method Summary (collapse)
-
- (Server) initialize(display = nil)
constructor
A new instance of Server.
- - (Object) start
- - (Object) stop
Constructor Details
- (Server) initialize(display = nil)
A new instance of Server
27 28 29 |
# File 'lib/vnctools/server.rb', line 27 def initialize(display = nil) @display = display end |
Class Attribute Details
+ (Object) executable
20 21 22 |
# File 'lib/vnctools/server.rb', line 20 def executable @executable ||= "tightvncserver" end |
Instance Attribute Details
- (Object) display (readonly)
Returns the value of attribute display
25 26 27 |
# File 'lib/vnctools/server.rb', line 25 def display @display end |
Class Method Details
+ (Object) all
14 15 16 |
# File 'lib/vnctools/server.rb', line 14 def all displays.map { |display| new ":#{display}" } end |
+ (Object) displays
10 11 12 |
# File 'lib/vnctools/server.rb', line 10 def displays Dir[File.("~/.vnc/*.pid")].map { |e| e[/(\d+)\.pid/, 1] }.compact end |
Instance Method Details
- (Object) start
31 32 33 34 35 36 37 38 |
# File 'lib/vnctools/server.rb', line 31 def start if display server(display, *launch_arguments) else output = server(*launch_arguments) @display = output[/desktop is #{host}(\S+)/, 1] end end |
- (Object) stop
40 41 42 |
# File 'lib/vnctools/server.rb', line 40 def stop server "-kill", display.to_s end |