# File lib/ole/support.rb, line 210 def initialize flags flags = IO.parse_mode flags.to_str if flags.respond_to? :to_str raise ArgumentError, "invalid flags - #{flags.inspect}" unless Fixnum === flags @flags = flags end
# File lib/ole/support.rb, line 229 def append? (@flags & APPEND) != 0 end
# File lib/ole/support.rb, line 237 def binary? (@flags & BINARY) != 0 end
# File lib/ole/support.rb, line 233 def create? (@flags & CREAT) != 0 end
# revisit this def apply io
if truncate? io.truncate 0 elsif append? io.seek IO::SEEK_END, 0 end
end
# File lib/ole/support.rb, line 252 def inspect names = NAMES.map { |name| name if (flags & Mode.const_get(name.upcase)) != 0 } names.unshift 'rdonly' if (flags & 0x3) == 0 "#<#{self.class} #{names.compact * '|'}>" end
# File lib/ole/support.rb, line 221 def readable? (@flags & WRONLY) == 0 end
# File lib/ole/support.rb, line 225 def truncate? (@flags & TRUNC) != 0 end
# File lib/ole/support.rb, line 216 def writeable? #(@flags & RDONLY) == 0 (@flags & 0x3) != RDONLY end