Class: VpsAdmin::CLI::Commands::VpsRemoteControl::HttpClient
- Inherits:
-
Object
- Object
- VpsAdmin::CLI::Commands::VpsRemoteControl::HttpClient
- Defined in:
- lib/vpsadmin/cli/commands/vps_remote_console.rb
Instance Attribute Summary collapse
-
#error ⇒ Object
readonly
Returns the value of attribute error.
Instance Method Summary collapse
- #error? ⇒ Boolean
-
#initialize(vps, token, rate) ⇒ HttpClient
constructor
A new instance of HttpClient.
- #join ⇒ Object
- #resize(width, height) ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
- #stop? ⇒ Boolean
- #write(data) ⇒ Object
Constructor Details
#initialize(vps, token, rate) ⇒ HttpClient
Returns a new instance of HttpClient.
89 90 91 92 93 94 95 96 97 |
# File 'lib/vpsadmin/cli/commands/vps_remote_console.rb', line 89 def initialize(vps, token, rate) @vps = vps @token = token @rate = rate @mutex = Mutex.new @write_buffer = '' @stop = false @error = false end |
Instance Attribute Details
#error ⇒ Object (readonly)
Returns the value of attribute error.
115 116 117 |
# File 'lib/vpsadmin/cli/commands/vps_remote_console.rb', line 115 def error @error end |
Instance Method Details
#error? ⇒ Boolean
111 112 113 |
# File 'lib/vpsadmin/cli/commands/vps_remote_console.rb', line 111 def error? @error != false end |
#join ⇒ Object
117 118 119 120 |
# File 'lib/vpsadmin/cli/commands/vps_remote_console.rb', line 117 def join stop thread.join end |
#resize(width, height) ⇒ Object
128 129 130 131 |
# File 'lib/vpsadmin/cli/commands/vps_remote_console.rb', line 128 def resize(width, height) @width = width @height = height end |
#start ⇒ Object
99 100 101 |
# File 'lib/vpsadmin/cli/commands/vps_remote_console.rb', line 99 def start @thread = Thread.new { run } end |
#stop ⇒ Object
103 104 105 |
# File 'lib/vpsadmin/cli/commands/vps_remote_console.rb', line 103 def stop @stop = true end |
#stop? ⇒ Boolean
107 108 109 |
# File 'lib/vpsadmin/cli/commands/vps_remote_console.rb', line 107 def stop? @stop end |
#write(data) ⇒ Object
122 123 124 125 126 |
# File 'lib/vpsadmin/cli/commands/vps_remote_console.rb', line 122 def write(data) mutex.synchronize do write_buffer << data end end |