Class IO::Mode
In: lib/ole/support.rb
Parent: Object
Symbol IO Logger File String Enumerable RecursivelyEnumerable dot/f_1.png

Methods

append?   binary?   create?   inspect   new   readable?   truncate?   writeable?  

Included Modules

Constants

Classes and Modules

Module IO::Mode::Constants

Constants

NAMES = %w[rdonly wronly rdwr creat trunc append binary]

Attributes

flags  [R] 

Public Class methods

[Source]

     # File lib/ole/support.rb, line 207
207:                 def initialize flags
208:                         flags = IO.parse_mode flags.to_str if flags.respond_to? :to_str
209:                         raise ArgumentError, "invalid flags - #{flags.inspect}" unless Fixnum === flags
210:                         @flags = flags
211:                 end

Public Instance methods

[Source]

     # File lib/ole/support.rb, line 226
226:                 def append?
227:                         (@flags & APPEND) != 0
228:                 end

[Source]

     # File lib/ole/support.rb, line 234
234:                 def binary?
235:                         (@flags & BINARY) != 0
236:                 end

[Source]

     # File lib/ole/support.rb, line 230
230:                 def create?
231:                         (@flags & CREAT) != 0
232:                 end

[Source]

     # File lib/ole/support.rb, line 249
249:                 def inspect
250:                         names = NAMES.map { |name| name if (flags & Mode.const_get(name.upcase)) != 0 }
251:                         names.unshift 'rdonly' if (flags & 0x3) == 0
252:                         "#<#{self.class} #{names.compact * '|'}>"
253:                 end

[Source]

     # File lib/ole/support.rb, line 218
218:                 def readable?
219:                         (@flags & WRONLY) == 0
220:                 end

[Source]

     # File lib/ole/support.rb, line 222
222:                 def truncate?
223:                         (@flags & TRUNC) != 0
224:                 end

[Source]

     # File lib/ole/support.rb, line 213
213:                 def writeable?
214:                         #(@flags & RDONLY) == 0
215:                         (@flags & 0x3) != RDONLY
216:                 end

[Validate]