Class: RIO::NullIOMode

Inherits:
Object show all
Defined in:
lib/rio/nullio.rb

Overview

:nodoc: all

Instance Method Summary collapse

Constructor Details

#initialize(mode_string) ⇒ NullIOMode

Returns a new instance of NullIOMode.



46
47
48
# File 'lib/rio/nullio.rb', line 46

def initialize(mode_string)
  @str = mode_string
end

Instance Method Details

#=~(re) ⇒ Object



59
60
61
# File 'lib/rio/nullio.rb', line 59

def =~(re)
  re =~ @str
end

#appends?Boolean

Returns:

  • (Boolean)


56
57
58
# File 'lib/rio/nullio.rb', line 56

def appends?
  @str =~ /^a/
end

#can_read?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/rio/nullio.rb', line 53

def can_read?
  @str =~ /^r/ or @str =~ /\+/
end

#can_write?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/rio/nullio.rb', line 50

def can_write?
  @str =~ /^[aw]/ or @str =~ /\+/
end

#to_sObject



49
# File 'lib/rio/nullio.rb', line 49

def to_s() @str end