Class: Audrey::Mode

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

Overview

Audrey::Mode

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(p_mode) ⇒ Mode


initialize



638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
# File 'lib/audrey.rb', line 638

def initialize(p_mode)
	# $tm.hrm
	
	# mode cannot be tainted
	if p_mode.tainted?
		raise 'cannot-use-tainted-read-write-mode'
	end
	
	# set read and write
	if (p_mode == 'rw') or (p_mode == 'wr')
		@read = true
		@write = true
	elsif p_mode == 'r'
		@read = true
		@write = false
	elsif p_mode == 'w'
		@read = false
		@write = true
	else
		raise 'unknown-mode: ' + p_mode.to_s
	end
end

Instance Attribute Details

#readObject (readonly)

Returns the value of attribute read.



632
633
634
# File 'lib/audrey.rb', line 632

def read
  @read
end

#writeObject (readonly)

Returns the value of attribute write.



633
634
635
# File 'lib/audrey.rb', line 633

def write
  @write
end