Skip to content

Instantly share code, notes, and snippets.

@akiray03
Created December 21, 2013 14:49
Show Gist options
  • Select an option

  • Save akiray03/8070300 to your computer and use it in GitHub Desktop.

Select an option

Save akiray03/8070300 to your computer and use it in GitHub Desktop.
class IO
def write(string)
str = string.is_a?(String) ? string : string.to_s
return str.size unless str.size > 0
len = syswrite(str)
if str.size == len
@pos += len
return len
end
raise IOError
end
end
class IO
def _read_buf
return @buf if @buf && @buf.size > 0
@buf = sysread(BUF_SIZE)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment