Class: MockFS::FileAdapter::Mode

Inherits:
Object
  • Object
show all
Defined in:
lib/mockfs.rb

Overview

:nodoc:

Instance Method Summary collapse

Constructor Details

#initialize(string_or_bitwise) ⇒ Mode

Returns a new instance of Mode.



325
326
327
328
329
330
331
332
333
334
335
336
337
# File 'lib/mockfs.rb', line 325

def initialize( string_or_bitwise )
	if string_or_bitwise.is_a?( String )
		if string_or_bitwise == 'w'
			@bitwise = File::WRONLY
		elsif string_or_bitwise == 'r'
			@bitwise = File::RDONLY
		elsif string_or_bitwise == 'a'
			@bitwise = File::APPEND
		end
	else
		@bitwise = string_or_bitwise
	end
end

Instance Method Details

#append?Boolean

Returns:

  • (Boolean)


339
# File 'lib/mockfs.rb', line 339

def append?; @bitwise & File::APPEND == File::APPEND; end

#read_only?Boolean

Returns:

  • (Boolean)


341
# File 'lib/mockfs.rb', line 341

def read_only?; @bitwise == File::RDONLY; end