bitwise bools

in the wild

StringIO Modes

require "stringio"

io = StringIO.new("hello".freeze)
io << "world"
require "stringio"

io = StringIO.new("hello".freeze)
io << "world"
# 💣 IOError: not opened for writing
require "stringio"

io = StringIO.new("hello".freeze)
io << "world"
# 💣 IOError: not opened for writing

io2 = StringIO.new("hello".freeze, "w+")
require "stringio"

io = StringIO.new("hello".freeze)
io << "world"
# 💣 IOError: not opened for writing

io2 = StringIO.new("hello".freeze, "w+")
# 💣 Errno::EACCES: Permission denied
require "stringio"

io = StringIO.new("hello".freeze)
io << "world"
# 💣 IOError: not opened for writing

io2 = StringIO.new("hello".freeze, "w+")
# 💣 Errno::EACCES: Permission denied

io3 = StringIO.new("hello".freeze, File::RDWR)
require "stringio"

io = StringIO.new("hello".freeze)
io << "world"
# 💣 IOError: not opened for writing

io2 = StringIO.new("hello".freeze, "w+")
# 💣 Errno::EACCES: Permission denied

io3 = StringIO.new("hello".freeze, File::RDWR)
# 💣 Errno::EACCES: Permission denied

Open Modes

File.open("my-file.txt", "r")

bitwise boolsin the wild

By Tony Ta

bitwise boolsin the wild

  • 166