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



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

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.



635
636
637
# File 'lib/audrey.rb', line 635

def read
  @read
end

#writeObject (readonly)

Returns the value of attribute write.



636
637
638
# File 'lib/audrey.rb', line 636

def write
  @write
end