class FakeFS::File
def extract_binmode(opts, fmode)
def extract_binmode(opts, fmode) textmode = opts[:textmode] unless textmode.nil? raise ArgumentError, "textmode specified twice" if fmode & FMODE_TEXTMODE != 0 raise ArgumentError, "both textmode and binmode specified" if fmode & FMODE_BINMODE != 0 # yep, false has no effect here, but still causes ArgumentError fmode |= FMODE_TEXTMODE if textmode end binmode = opts[:binmode] unless binmode.nil? raise ArgumentError, "binmode specified twice" if fmode & FMODE_BINMODE != 0 raise ArgumentError, "both textmode and binmode specified" if fmode & FMODE_TEXTMODE != 0 fmode |= FMODE_BINMODE if binmode end if fmode & FMODE_BINMODE != 0 && fmode & FMODE_TEXTMODE != 0 raise ArgumentError, "both textmode and binmode specified" end fmode end