class HaveAPI::Fs::Components::RemoteControlFile::FileHandle

Attributes

read_buf[RW]
write_buf[RW]

Public Class Methods

new() click to toggle source
# File lib/haveapi/fs/components/remote_control_file.rb, line 19
def initialize
  @read_buf = ''
  @write_buf = ''
end

Public Instance Methods

complete?() click to toggle source
# File lib/haveapi/fs/components/remote_control_file.rb, line 32
def complete?
  @write_buf.end_with?(MSG_DELIMITER)
end
parse() click to toggle source
# File lib/haveapi/fs/components/remote_control_file.rb, line 36
def parse
  cmd = YAML.load(@write_buf[0..(-1 - MSG_DELIMITER.size)])
  @write_buf.clear
  cmd
end
read(offset, size) click to toggle source
# File lib/haveapi/fs/components/remote_control_file.rb, line 24
def read(offset, size)
  @read_buf[offset, size]
end
write(offset, size, buf) click to toggle source
# File lib/haveapi/fs/components/remote_control_file.rb, line 28
def write(offset, size, buf)
  @write_buf[offset, size] = buf
end