Class: RIO::Mode::Int

Inherits:
Base show all
Defined in:
lib/rio/iomode.rb

Instance Method Summary collapse

Methods inherited from Base

#allows_read?, #allows_write?, #copy, #initialize, #read_only?, #to_s, #write_only?

Constructor Details

This class inherits a constructor from RIO::Mode::Base

Instance Method Details

#allows_both?Boolean

@mode&File::APPEND

Returns:

  • (Boolean)


101
102
103
# File 'lib/rio/iomode.rb', line 101

def allows_both?()
#        @mode[1,-1] == '+'
end

#creates?Boolean

@mode == ‘+’

Returns:

  • (Boolean)


104
105
106
# File 'lib/rio/iomode.rb', line 104

def creates?() 
  # primarily_append? || primarily_write? 
end

#primarily_append?Boolean

@mode&File::WRONLY || (@mode&File::RDWR && @mode&File::TRUNC) || primarily_append?

Returns:

  • (Boolean)


98
99
100
# File 'lib/rio/iomode.rb', line 98

def primarily_append?() 
#        @mode&File::APPEND
end

#primarily_read?Boolean

Returns:

  • (Boolean)


92
93
94
# File 'lib/rio/iomode.rb', line 92

def primarily_read?() 
#        (@mode&File::RDONLY || (@mode&File::RDWR && ~(@mode&File::TRUNC)))
end

#primarily_write?Boolean

(@mode&File::RDONLY || (@mode&File::RDWR && ~(@mode&File::TRUNC)))

Returns:

  • (Boolean)


95
96
97
# File 'lib/rio/iomode.rb', line 95

def primarily_write?() 
#        @mode&File::WRONLY || (@mode&File::RDWR && @mode&File::TRUNC) || primarily_append? 
end