Class: RIO::Mode::Base
- Extended by:
- Forwardable
- Defined in:
- lib/rio/iomode.rb
Instance Method Summary collapse
- #allows_read? ⇒ Boolean
- #allows_write? ⇒ Boolean
- #copy(other) ⇒ Object
-
#initialize(arg) ⇒ Base
constructor
A new instance of Base.
- #read_only? ⇒ Boolean
- #to_s ⇒ Object
- #write_only? ⇒ Boolean
Constructor Details
#initialize(arg) ⇒ Base
Returns a new instance of Base.
46 47 48 49 50 51 52 |
# File 'lib/rio/iomode.rb', line 46 def initialize(arg) if arg.kind_of? self.class copy(arg) else @mode = arg end end |
Instance Method Details
#allows_read? ⇒ Boolean
68 69 70 |
# File 'lib/rio/iomode.rb', line 68 def allows_read?() primarily_read? or allows_both? end |
#allows_write? ⇒ Boolean
71 72 73 |
# File 'lib/rio/iomode.rb', line 71 def allows_write?() primarily_write? or allows_both? end |
#copy(other) ⇒ Object
54 55 56 |
# File 'lib/rio/iomode.rb', line 54 def copy(other) @mode = other.mode end |
#read_only? ⇒ Boolean
62 63 64 |
# File 'lib/rio/iomode.rb', line 62 def read_only?() allows_read? and !allows_write? end |
#to_s ⇒ Object
58 |
# File 'lib/rio/iomode.rb', line 58 def to_s() @mode.to_s end |
#write_only? ⇒ Boolean
65 66 67 |
# File 'lib/rio/iomode.rb', line 65 def write_only?() !allows_read? and allows_read? end |