Class: Isomorfeus::Speednode::Runtime::VMCommand
- Inherits:
-
Object
- Object
- Isomorfeus::Speednode::Runtime::VMCommand
- Defined in:
- lib/isomorfeus/speednode/runtime.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(socket, cmd, arguments) ⇒ VMCommand
constructor
A new instance of VMCommand.
Constructor Details
#initialize(socket, cmd, arguments) ⇒ VMCommand
Returns a new instance of VMCommand.
5 6 7 8 9 |
# File 'lib/isomorfeus/speednode/runtime.rb', line 5 def initialize(socket, cmd, arguments) @socket = socket @cmd = cmd @arguments = arguments end |
Instance Method Details
#execute ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/isomorfeus/speednode/runtime.rb', line 11 def execute result = '' = ::Oj.dump({ 'cmd' => @cmd, 'args' => @arguments }, mode: :strict) @socket.sendmsg( + "\x04") begin result << @socket.recvmsg()[0] end until result.end_with?("\x04") ::Oj.load(result.chop!, create_additions: false) end |