Class: Audrey::Mode
- Inherits:
-
Object
- Object
- Audrey::Mode
- Defined in:
- lib/audrey.rb
Overview
Audrey::Mode
Instance Attribute Summary collapse
-
#read ⇒ Object
readonly
Returns the value of attribute read.
-
#write ⇒ Object
readonly
Returns the value of attribute write.
Instance Method Summary collapse
-
#initialize(p_mode) ⇒ Mode
constructor
————————————————————————— initialize.
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 |